OAI / oascomply

Apache License 2.0
22 stars 6 forks source link

Schema patching as user extension point? #5

Open handrews opened 1 year ago

handrews commented 1 year ago

One way for a user familiar with JSON Schema to extend the validation rules would be further patch the OAS schema(s). For example, an additional pattern keyword applied to result statuses could be used to enforce that result codes only come from a certain set.

It might be helpful to allow configuring a list of JSON Patch or JSON Merge Patch documents (in json or yaml) to be applied in order prior to running schema validation. The different formats are easy to distinguish - a JSON Patch is always an array, and for patching these schemas, a JSON Merge Patch will always be an object.

This would not be the most user-friendly extension point, but it would be easy to support and very powerful for those who are comfortable with it.