Shared JSON Schema

Concept use JSON Schema to share validation logic between PHP and JS, also for generated TypeScript definitions.

Stating with handwritten schema files and using them to generate TypeScript types is the workflow I am experimenting with.

Possible libraries

Run examples

  1. Install dependencies

  2. Build the TypeScript types from the JSON Schema files.

    npm run build
  3. Run the examples

    For the PHP example:

    php main.php

    For the JavaScript example:

    node js/validator.php