Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Make schema validation compatible to OpenAPI's schema definitions. #598

Open
ePaul opened this issue Mar 8, 2017 · 2 comments
Open

Make schema validation compatible to OpenAPI's schema definitions. #598

ePaul opened this issue Mar 8, 2017 · 2 comments

Comments

@ePaul
Copy link
Member

ePaul commented Mar 8, 2017

OpenAPI (in both of version 2.0 and the upcoming 3.0) uses an extended subset of JSON schema for their schema definitions.

As often REST APIs are defined via OpenAPI and services want to use the same definition for both the Nakadi event schema and their "Restful" API, it would be useful if valid OpenAPI schemas would also be supported here.

The main differences are some additional fields, which are not in JSON schema. Here the list for OpenAPI 2.0:

  • discriminator
  • readOnly
  • xml
  • externalDocs
  • example
  • x-* (extensions).

For 3.0 we get (link to implementer's draft RC0) in addition

  • nullable
  • writeOnly
  • examples
  • deprecated

My proposal is to simply accept and ignore those properties when they are encountered instead of refusing the event type definition.

This would e.g. allow to use x-extensible-enum to describe a property with an extensible enum.

@lmontrieux
Copy link
Contributor

@rcillo what do you think about this? The issue I see is that we use a third party library for schema validation, and I don't know how it will behave with these properties.

@rcillo
Copy link
Contributor

rcillo commented May 29, 2017

@lmontrieux it's already allowed to use these attributes under "forward" mode. They behave as @ePaul suggested: they are no-op. Changes to them are not regulated by compatibility checks, i.e. one could remove attributes from x-extensible-enum and we would not complain.

We just do not support them for "compatible". That would be much harder and the evolution rules would have to be reviewed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants