How Jane works¶
This documentation describes how JSON Schema & OpenAPI Jane libraries work to generate the code. It is mainly oriented for people wanting to contribute to theses libraries.
Theses libraries is based on 3 different steps:
First step is to guess a set of metadata given a specification (JsonSchema or OpenAPI at the time of writing this).
To do so, it will read the specification, transform it into objects and pass it to guessers implementing one of
Each guesser tell if it supports the current specification and returns metadata. Occasionally, it will try to guess sub objects of the specification.
Once all metadata are guessed, they are passed to a set of generators implementing the
GeneratorInterface given a
Then, each generator will analyze the metadata and create PHP code by using the PHP Parser Library. Using the library improves the flexibility to create complex code, as using a template generator solution.
Context provides a lots of functions to generate code, like using unique variable name in a scope or adding generated file.