Application to generate constrained SKDs based on JSON schemas
Open Issues: 1
- icanboogie/inflector: ^1.4
- justinrainbow/json-schema: ^3.0
- nikic/php-parser: ^2.1
- symfony/console: ^3.1
This package is auto-updated.
Last update: 2023-05-14 18:48:55 UTC
A tool for creating PHP data structures from JSON Schemas.
composer create-project calcinai/gendarme
From the project root:
./bin/gendarme generate --namespace [TARGET_NAMESPACE] --root-class [ROOT_CLASS] [SCHEMA_FILE].json [OUTPUT_DIR]
All models will be PSR-4 compliant based on the arguments given at runtime. A typical output folder structure will be as follows:
- OUTPUT_DIR - BaseSchema.php (the class all models extend) - RootClass.php (the --root-class argument) - Definitions - ... - ...
This project was started to generate the schema files for Strut, a Swagger/OAPI manipulation library. Although a very complex example, it shows the basic output structure that will be generated.
The generated models will include type-hinting to other models where possible, and non-hintable objects will be put in the doc blocks. At this point, many, but not all schema keywords are parsed. As more desired functionality is identified, more can be implemented.