Project goal is to provide an easy-to-use tool for Angular engineers to check HTTP response schemas at run-time and to identify/handle schema errors.
- io-ts support: relevant sources available in
workspace/projects/typesafe-http-iotsdirectory - zod support: relevant sources available in
workspace/projects/typesafe-http-zoddirectory
- Angular CLI (v16+)
- Node.js, according to Angular version
Contributions are welcome! Please follow these high-level steps:
- Fork the repository.
- Create a new branch for your feature or bug fix.
- Commit your changes and push the branch.
- Submit a pull request.
- Create directory for major version in
./versionsdirectory. Name must followngXXscheme whereXXis major version number of Angular. E.g. for supporting Angular 20, it'd beng20. - Add
./versions/ngXX/package.json. This is the complete workspacepackage.jsonfor this Angular version. It must contain all Angular version-specificdependencies,devDependencies, andscripts. - Add
./versions/ngXX/angular.json. This is the complete Angular workspace configuration for this version. - Add
./versions/ngXX/package.iots.jsonand./versions/ngXX/package.zod.json. These are the completepackage.jsonfiles for the io-ts and zod libraries respectively. ThepeerDependenciessection must list@angular/coreand@angular/commonwith versions following>=XX.0.0 <YY.0.0pattern, whereXXis the current andYYis the next Angular version. E.g.>=20.0.0 <21.0.0. - Add
./versions/ngXX/files.json. This manifest declares all files that should be copied from the version directory into the workspace directory whenprepws:ngXXruns. It must include entries forpackage.json,angular.json, the library package files, and any other version-specific files such as ESLint config, TypeScript types, test setup, spec files, and tsconfig overrides. It follows this format:{ "copy": [ { "from": "eslint.config.js", "to": "eslint.config.js" }, { "from": "angular.json", "to": "angular.json" }, { "from": "package.json", "to": "package.json" }, { "from": "package.iots.json", "to": "projects/typesafe-http-iots/package.json" }, { "from": "package.zod.json", "to": "projects/typesafe-http-zod/package.json" }, { "from": "http-options-base.type.ts", "to": "projects/typesafe-http-iots/src/lib/types/http-options-base.type.ts" }, { "from": "http-options-base.type.ts", "to": "projects/typesafe-http-zod/src/lib/types/http-options-base.type.ts" } ] }fromis relative to the version directory.tois relative to theworkspace/directory.- Add an entry for every file that varies between Angular versions (ESLint config, TypeScript types file, test setup, spec files, tsconfig overrides, etc.).
- If the version introduces a new test runner (e.g. Vitest), add the corresponding
tsconfig.spec.json,tsconfig.spec.iots.json, andtsconfig.spec.zod.jsonoverrides to the version directory, register them infiles.json, and configure thearchitect.testsection inangular.jsonaccordingly. - Add relevant
prepws:ngXXscript to repository's./package.json. - Update package version to next major version in
./package.jsononly. The version is automatically propagated to each library'spackage.jsonright before its build step.
NOTE that version support removal must be applied to oldest version only and only 1 version is allowed to be removed in one shot!
- Remove relevant
prepws:ngXXscript from repository'spackage.json - Remove
ngXXdirectory and its content from./versionsdirectory - Update package version to next major version in
./package.jsononly. The version is automatically propagated to each library'spackage.jsonright before its build step.
- Apply your changes in library or libraries under
workspace/projects/directory npm run lintnpm run test- Follow Manual testing of library for each supported version to discover discrepancies
- Update package version in
./package.jsononly (it is propagated automatically to each library'spackage.jsonright before its build step) as follows:- to next minor version, when:
- new feature added to all libraries
- new runtime-type-checker library support added
- to next build, when:
- any fix applied on at least one of the libraries
- to next minor version, when:
NOTE that proper Node.js version must be prepared before library build started. Please check table below for reference versions:
| Tagname | Node version |
|---|---|
ng16 |
18.16.1 |
ng17 |
18.16.1 |
ng18 |
18.20.8 |
ng19 |
18.20.8 |
ng20 |
20.19.0 |
ng21 |
20.19.0 |
Consider using NVM tool to smoothly switch from one version to another.
npm run prepws:ngXX
cd workspace
npm run build:lib
npm run publish:iots -- --tag ngXX
Minimalist sample apps included in repository, see /sample-apps directory.
Here's a full script to manually test library changes across all supported Angular versions:
npm run prepws:ngXX
cd workspace
npm run lint:lib
npm run test
npm run build:lib
rm -rf projects/sample-iots
rm -rf projects/sample-zod
npm run ng -- generate application sample-iots
npm run ng -- generate application sample-zod
rm -rf projects/sample-iots/src
rm -rf projects/sample-zod/src
cp -R ../sample-apps/iots/ projects/sample-iots
cp -R ../sample-apps/zod/ projects/sample-zod
npm run ng -- serve sample-iots
ctrl-c
npm run ng -- serve sample-zod
ctrl-c
cd ..Run this script above on all available versions.
No NPM publish recommended until all versions are checked and work as expected!
This project is licensed under the MIT License. See the LICENSE.md file for details.
For questions or support, please contact peppierre@gmail.com.