-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
edit: decide on a schema #2643
Comments
Assessment of JSON Schema The current version is 2020-12 Specification links can be found here: |
Pros
Cons
|
Alternatives Other JSON data validators exist, and these can be used alongside tools such as jsonlint, for validating JSON for the correct format rather than allowing for custom validation of JSON instances. Other alternative architectures for API consideration include: OpenAPI, AsyncAPI. Some of the alternatives to JSON Schema are TypeSchema or JTD, that instead of focusing on validation, focus on the definition of data models. Although the addition of such an extra layer may just add unnecessary complexity. TypeSchema is a code generator friendly alternative to JsonSchema explained as: For code generators it is difficult to work with JSON Schema since it is designed to validate JSON data. In JSON Schema you don't need to provide any keywords i.e. {} is a valid JSON Schema which basically allows every value and the defined keywords are applied based on the actual data. This means you can interpret a schema only if you have also the actual data. A code generator on the other hand needs to determine a concrete type of a schema without the actual data. Because of this TypeSchema is designed in such a way that it is possible to determine a concrete type based on the used keywords. You can think: TypeSchema is to JsonSchema what TypeScript is to Javascript, a more type safe version which has also keywords for better inheritance, union/intersection and generic handling. JTD - jtd (jsontypedef.github.io) Validating JSON data in shell scripts with jtd-validate (jsontypedef.com) JSON Type Definition, aka RFC 8927, is an easy-to-learn, standardized way to define a schema for JSON data. You can use JSON Typedef to portably validate data across programming languages, create dummy data, generate code, and more. This jtd package is a JavaScript / TypeScript implementation of JSON Type Definition. It lets you validate input data against JSON Type Definition schemas. jtd works in Node.js and web browsers. If you're looking to generate code from schemas, check out "Generating TypeScript from JSON Typedef schemas" in the JSON Typedef docs. Other options:
|
Conclusion In summary, although there are some limitations, json-schema seems to be a good fit for allowing validation of translated metadata and there are many implementations and pre-existing tooling to facilitate an end-to-end metadata configuration editor in a modern web driven context. This is a good technology solution, although some further work is needed to verify extensibility options and for enabling custom widget capabilities. |
We are currently considering JSON Schema, however, we should have a quick look around to make sure this is the best choice.
Points in favour of JSON Schema:
The text was updated successfully, but these errors were encountered: