-
Notifications
You must be signed in to change notification settings - Fork 4
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
organization of JSON Schema files #29
Comments
In GitLab by @pvdbosch on Dec 12, 2018, 19:56 changed the description |
In GitLab by @pvdbosch on Dec 17, 2018, 15:46 Decided in the December meeting to repeat the (sub)domain and version in the file name with dash seperator:
Example:
Rationale:
Other decisions:
When publishing through HTTP, we could expose previous versions of a YAML as well:
|
In GitLab by @pvdbosch on Dec 21, 2018, 14:41 schemas and styleguide are updated (on git, not published yet) according to decisions reached on this issue |
In GitLab by @pvdbosch on Jan 3, 2019, 14:34 also added some parameters to schemas:
|
In GitLab by @pvdbosch on Jan 22, 2019, 14:40 closed |
In GitLab by @pvdbosch on Dec 12, 2018, 19:55
Determine guidelines to organize types and JSON schema files.
Context
Current recommendation (discussions in #26 and #20):
<domain>/<version>/<TypeName>.yaml
<domain>/<subdomain>/<version>/<TypeName>.yaml
Examples:
Originally, types were grouped into a single file per domain, e.g. a single common.yaml file with all Problem, LocalizedString, MergePatch and HttpLink types within a definitions property.
Then, it was decided to split common.yaml into separate files per main type; with the main type defined at root level and the definitions property only for subtypes so that they're more hidden i.e. private to the main type.
However, while valid JSON Schema, this doesn't appear to be valid according to the OpenAPI 2.0 SchemaObject spec, as a reference to type must not contain a definitions property.
Also, the number of YAML files to manage in this solution, might become difficult to manage.
All this reopens the discussion on how to organize JSON Schema files.
Alternatives
When published on the web, the URL would end in the same structure, except content negotiation would replace the YAML extension.
A variant would be to use more specific names then schema.yaml; though their name would need to be roughly equivalent to the directory names then.
Versioning is still on the (sub)domain level, and renaming files or moving types between them are a breaking change.
Private types
If there is a need for private types e.g. substructures in a Problem (sub)type, they could be listed in a
privateDefinitions
property instead of thedefinitions
one. For OpenAPI 2.0, this still should be OK as long as the JSON Pointer in a$ref
points a valid type definition.The text was updated successfully, but these errors were encountered: