Extensions in static file aren't available via extension methods
When we load an OAS 3.1 document from JSON/YAML, unknown fields are not currently identified as extensions since they are being added via set. Either Schema#set should be aware of the known properties so that unknown properties are internally identified as extensions, or we should call addExtension when processing these properties:
https://github.com/smallrye/smallrye-open-api/blob/9cf2fedd6610ac885e2543522b0786e2eb099f98/core/src/main/java/io/smallrye/openapi/runtime/io/media/SchemaIO.java#L126-L134
We discussed this at the call today. It's a bit confusing, Schema has separate get and set methods for setting arbitrary properties, and Extensible says that extensions should begin "x-". On the other hand, we don't enforce the extension key prefix afaik and it seems intuitive that anything that's not a known field is an extension.
We noted the following things to check:
- What do we do when reading and writing OAS 3.0 documents? Extensions there are required to start
x- - Do we have any TCK tests regarding extensions for OAS 3.1 schemas?
We also noted that currently, x- keys do not appear as extensions either.
What do we do when reading and writing OAS 3.0 documents? Extensions there are required to start
x-
- For 3.1 schemas, extensions are populated directly on the schema using
set - For 3.0 schemas, extensions are loaded using
ExtensionIO, which populates the schema viaaddExtensionand filters the input properties by thex-prefix. - For other object types,
ExtensionIOis used to determine if a property is an extension (x-) and adding the key/value viaaddExtension.
Do we have any TCK tests regarding extensions for OAS 3.1 schemas?
I was unable to locate any TCK tests that check reading of extensions from a static file - only annotations are checked.