-
-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: ensure doc consistancy and correctness about processing (#87)
Co-authored-by: Sergio Moya <1083296+smoya@users.noreply.github.com>
- Loading branch information
1 parent
5948aab
commit 4d26d1a
Showing
8 changed files
with
199 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
# Input processing | ||
The input process is about processing any input into our internal model representation `CommonInputModel`. This most likely have to be done using different methods based on which kind of input it is. | ||
|
||
As of now two inputs are supported: | ||
- JSON Schema Draft 7 | ||
- AsyncAPI version 2.0.0 | ||
|
||
## Internal model representation | ||
|
||
![Class diagram](./assets/class_diagram.png) | ||
|
||
As seen on the class diagram the `InputProcessor` is our main point of entry for processing input data. | ||
|
||
It uses the defined input processors (`AsyncAPIInputProcessor`, `JsonSchemaInputProcessor`, ...) by first calling `shouldProcess` function of each and if the function returns true it calls the `process` function. | ||
|
||
If no processes returns true it defaults to `JsonSchemaInputProcessor`. | ||
|
||
The `process` function are expected to return `CommonInputModel` which is a wrapper for the core data representation of `CommonModel`. | ||
|
||
This is done to ensure we can return multiple models for any input to allow for references, inheritance etc. | ||
|
||
As said the core internal representation of a data model is `CommonModel`. This contains the data definition by using known keywords from JSON Schema, but instead of it representing a validation rules it represent data definition. The explanation for the `CommonModel` properties can be found [here](../API.md#CommonModel). | ||
## AsyncAPI | ||
At the moment the library only supports the whole AsyncAPI file as input where it generates models for all defined message payloads. If any other kind of AsyncAPI input is wanted please create a [feature request](https://github.com/asyncapi/generator-model-sdk/issues/new?assignees=&labels=enhancement&template=enhancement.md)! | ||
|
||
The AsyncAPI input processor expects that the property `asyncapi` is defined in order to know it should be processed using this. | ||
|
||
The payload, since it is of type JSON Schema, is then passed to the [JSON Schema processor](#JSON-Schema) which handle the rest of the processing. | ||
|
||
|
||
## JSON Schema | ||
For us to convert JSON Schema into `CommonInputModel` we use a process we call the simplification process. This means that we simplify data validation rules (`Schema` or Boolean) into data definitions (`CommonModel`). This process is quite complex and needs it own section for explaining how it works. | ||
|
||
Read [this](./docs/simplification.md) document for more information. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.