Collect OpenAPI specification extensions during the model parsing phase
pmlopes opened this issue · 0 comments
OpenAPI has the concept of https://spec.openapis.org/oas/v3.1.0#specification-extensions that can be applicable to almost all defined types in the spec. This is a best-effort/optional feature for implementor.
In down stream modules such as vertx-web-openapi-router we could use this extra information to allow users to get more knowledge on their implementations.
The specification read:
"The extensions may or may not be supported by the available tooling, but those may be extended as well to add requested support (if tools are internal or open-sourced)."
Accessing the collected extensions can be done from objects using a getExtensions() new method, a read only getter for a Map<String, ?>. The map is unbounded because the type of extension is Any.
- OpenAPIContract -> contains extensions from https://spec.openapis.org/oas/v3.1.0#openapi-object
- Path -> contains extensions from https://spec.openapis.org/oas/v3.1.0#path-item-object
- Operation -> contains extensions from https://spec.openapis.org/oas/v3.1.0#operation-object
Maybe, If we can detect others, log a warning stating that they are not supported/collected.