Skip to content

Repository files navigation

Typesafe HTTP

Goal

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.

Features

  • io-ts support: relevant sources available in projects/typesafe-http-iots directory
  • zod support: relevant sources available in projects/typesafe-http-zod directory

Prerequisites

  • Node.js 20.19.0 — use NVM to manage versions
  • Angular CLI is available via the local dev dependency (npm run ng -- ...)

Contribution

Contributions are welcome! Please follow these high-level steps:

  1. Fork the repository.
  2. Create a new branch for your feature or bug fix.
  3. Commit your changes and push the branch.
  4. Submit a pull request.

Updating Angular version support

The libraries are built with compilationMode: "partial", so a single ng21 build is compatible with the full peer-dependency range (ng16–ng21). When bumping to a newer Angular major:

  1. Update package.json dependencies to the new Angular version and run npm install.
  2. Update angular.json if any version-specific schema or builder references changed.
  3. Update peerDependencies in projects/typesafe-http-iots/package.json and projects/typesafe-http-zod/package.json to reflect the new supported range (e.g. adding ng22 → >=16.0.0 <23.0.0).
  4. Verify lint + tests + build still pass.
  5. Bump the version in package.json to the next major version.

Removing support of an older Angular version

NOTE: Only the oldest supported version may be removed, and only one per release.

  1. Update peerDependencies in projects/typesafe-http-iots/package.json and projects/typesafe-http-zod/package.json to raise the lower bound (e.g. dropping ng16 → >=17.0.0 <22.0.0).
  2. Bump the version in package.json to the next major version.

Improving library code

  1. Apply your changes under projects/ directory.
  2. npm run lint:lib
  3. npm test
  4. Follow Manual testing to verify the change works end-to-end.
  5. Update the version in package.json only (it is propagated automatically to each library's package.json right before its build step):
    • minor bump — new feature added to all libraries, or new runtime-type-checker support added
    • patch bump — any fix applied on at least one library

Building

npm install
npm run build:lib

Publishing

npm run build:release
npm run publish:iots
npm run publish:zod

Manual testing

Minimalist sample apps are included in the sample-apps/ directory.

npm run lint:lib && npm test && npm run build:lib
rm -rf projects/sample-iots projects/sample-zod
npm run ng -- generate application sample-iots
npm run ng -- generate application sample-zod
rm -rf projects/sample-iots/src 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 when done
npm run ng -- serve sample-zod    # Ctrl-C when done

License

This project is licensed under the MIT License. See the LICENSE.md file for details.

Contact

For questions or support, please contact peppierre@gmail.com.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages