[FOLIO-2814] Investigate use of "id" keyword and "$ref" keyword in JSON Schema Created: 01/Oct/20 Updated: 09/Oct/20 |
|
| Status: | In Progress |
| Project: | FOLIO |
| Components: | None |
| Affects versions: | None |
| Fix versions: | None |
| Type: | Task | Priority: | TBD |
| Reporter: | David Crossley | Assignee: | David Crossley |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | raml | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original estimate: | Not Specified | ||
| Issue links: |
|
||||||||||||
| Sprint: | |||||||||||||
| Development Team: | FOLIO DevOps | ||||||||||||
| Description |
|
The current set of JSON Schema files have no "id" keyword, and use the "$ref" keyword with a relative pathname to link between parent schema and child schema files. That configuration does operate successfully with the current RAML Module Builder RMB, and with the "lint-raml" facility in FOLIO CI to assess the RAML/JSON Schema. That "lint-raml" facility uses the "raml-1-parser" (i.e. raml-js-parser-2 current version v1.1.67) and its dependency, the schema validator z-schema z-schema can also be used independently to validate these schema, and to assess examples against their schema. However ajv cannot be utilised, as it requires "id" keyword in the schema. Also the new AMF tools for processing RAML/Schema (see
Conduct some investigations to potentially improve this situation. |
| Comments |
| Comment by David Crossley [ 09/Oct/20 ] |
|
The use of "$ref" to link between parent and child JSON Schema has been a bane of our project. There are many other FOLIO Jira tickets related to this general issue about "$ref". They are difficult to find with Jira limited search. This search gets close. There are also many other places that refer to the complexities of "$ref" and "id". This is a list of some: |
| Comment by David Crossley [ 09/Oct/20 ] |
|
With the aforementioned FOLIO tickets, we settled on the use of "pathname" and avoiding the use of dotdots ("../") – so child schema would be below their parent schema. One aspect that helped, is to have the shared "raml-util" submodule inside the "ramls" directory (i.e. ramls/raml-util). Now there are also various other shared RAML/Schema git submodules, so it has become even more complex. |
| Comment by David Crossley [ 09/Oct/20 ] |
|
Adding "id" keyword to schema is difficult in some cases where the same schema is referenced from different places. So handling that task in small chunks. One that was easier to handle was
|