OAI / oascomply

Apache License 2.0
21 stars 5 forks source link

Implement OAS 3.0 JSON Schema dialect in jschon #14

Closed handrews closed 1 year ago

handrews commented 1 year ago

Since we're using jschon for schema validation in general, we'll use it to validate examples and defaults against their schemas. This means that we need support for the OAS 3.0 dialect. While jschon only supports drafts 2019-09 and above, we can implement the 3.0 dialect by:

handrews commented 1 year ago

Implemented in PR #16. There are more formats to add, but there are always more formats to add...

MikeRalphson commented 1 year ago

With respect to items did you mean the constraint that type: array MUST have a sibling items keyword in OAS 3.0.x, even if it is items: {} or items: true ?

handrews commented 1 year ago

@MikeRalphson I was not aware of such a constraint in OAS 3.0, but... 👀 huh, there it is. I can add that. I think that it will be a rule that needs to be turn-off-able, not unlike some format validation (e.g. GitHub's API description has a rather loose interpretation of "format": "uri" and fails validation because of it). But it's a MUST in the spec so it will need to be on by default.

I might implement that (and the next-to-allOf/anyOf/oneOf constraint for discriminator) with schema validation as otherwise I can't re-use the existing 2020-12 items implementation.

My comment on items was just about forbidding the array form of the keyword, which was split out into prefixItems in 2020-12.

Anyway, nice catch, feel free to file issues on anything that seems missing.