I wasn't sure whether to file this as a bug report or a feature request. Also this may actually belong in the Schemata module issue queue instead.
We are using the Schemata module to generate JSON Schemas of our data models. This works well with JSON API module by default for generating Schemas that reflect those endpoints. However, once we turn on JSON API Extras module and begin making customizations, the schemas generated by Schemata do not reflect these customizations and are therefore no longer valid with our live endpoints.
This is likely also affecting the OpenAPI module, but I have not yet confirmed.
Comment | File | Size | Author |
---|---|---|---|
#6 | 2874642--schemata--6.patch | 5.54 KB | e0ipso |
#6 | 2874642--interdiff--4-6.txt | 3.56 KB | e0ipso |
#4 | 2874642--schema-support-1.patch | 4.97 KB | dpolant |
Comments
Comment #2
e0ipsoThe schemata module normalizes the entity types. That means that any changes on top of that need to be maintained manually.
That is why all the enhancers need a method to declare the new schema.
The remaining task is to merge the schema for that particular field with the new schema from the enhancer.
Comment #3
e0ipsoBumping priority.
Comment #4
dpolant CreditAttribution: dpolant commentedAttached is my first pass at this.
I've added overridden normalizers for Schemata's FieldDefinitionNormalizer (for adding enhancer special schemas) and SchemataSchemaNormalizer (for implementing top-level field name changes/removals).
Comment #5
e0ipsoThis looks great. Only a minor change.
Yes.
getJsonSchema
will be required. Enhancers should be explicit about the output.Also, we should merge the existing schema with the schema from the enhancer. Otherwise we will lose information about the field instance like the description, allowed values, …
I realize that schemata is not outputting the schema for type and ID, but that doesn't impact this ticket.
Comment #6
e0ipsoI think this is a great start. I'm going to merge this and we can iron out any other wrinkle that appears.
Comment #8
e0ipso