-
Notifications
You must be signed in to change notification settings - Fork 83
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
[OAS 3.1.0] Schema changes #584
Comments
Here are my initial thoughts: At a high level, the new JSON schema is very flexible. The core spec defines the idea of a "vocabulary" - a set of properties which have a documented meaning in a JSON schema - and a "dialect" - a set of vocabularies which are supported. The core spec defines a core vocabulary, and two vocabularies for applying subschemas. The validation spec defines vocabularies for validating the structure and contents of a JSON document, a vocabulary for annotating a schema with metadata like a description and a dialect which includes all the required vocabularies of the core and validation specs. The OpenAPI spec then defines its own vocabulary containing some extensions, and a dialect which requires the required JSON schema vocabularies and the OpenAPI vocabulary. By default, all schemas use the dialect defined by OpenAPI, but they can also choose to use a different dialect by using the In theory, a user can write their OpenAPI document using any dialect of JSON schema they like, as long as they declare it in the document. If we want to be able to read any OpenAPI document the user might package in their application, our model would need to handle any arbitrary JSON document as a schema. |
Here are the things that I think have changed in the schema between 3.0 and 3.1 that would need to be reflected in our model: New fields (core)
Changed fields (core)
New fields (validation)
Changed fields (validation)
Removed fields
Additional
The following fields are new in the core schema, but I'm not sure if they're relevant to its use in OpenAPI:
I don't think users of OpenAPI are likely to want to use these fields, but we need to accommodate them anyway since they're valid so we must be able to read them from a user-supplied document. However, since OpenAPI permits arbitrary dialects, our model may need to allow arbitrary JSON as the schema anyway. If we include a mechanism to allow arbitrary additional properties, we could say that these properties can only be set through that mechanism. |
A few things I noticed while trying to implement this for smallrye:
|
Wouldn't having For the second issue, I think omitting |
Yes, you can have a semanitcally equivalent end result, but it makes trying to keep existing code which uses the interface working difficult. At the moment, I've deprecated However, you can't quite do that consistently. If the user calls Whether that's an issue or not depends on how you implement freeform objects. I tried making the |
OAS 3.1.0 changes from supporting most of an older JSON schema draft to supporting the whole of the JSON Schema 2020-12 draft Core and Validation.
We need to work out:
Schema
model class to support the 3.1.0 schema@Schema
and related annotations in order to allow users to take advantage of the new functionality that is availableTasks:
Schema
model@Schema
annotation to expose new and changed parts of the schema model Schema annotation updates #601@Schema
attributes Schema annotation updates #601The text was updated successfully, but these errors were encountered: