Open jeremyfiel opened 1 month ago
Good question. They are somewhat different as the first one is using for the code typing while the second one is for an OAS description typing. Ideally they should be synchronised, but I cannot come up with a reliable solution to enforce that.
https://github.com/Redocly/redocly-cli/blob/f11ebcbe1349c5593fbd40ca14259ff432a04b5a/packages/core/src/typings/openapi.ts#L160-L164
https://github.com/Redocly/redocly-cli/blob/f11ebcbe1349c5593fbd40ca14259ff432a04b5a/packages/core/src/types/oas3_1.ts#L90-L185
Should these two separate typings be refactored to use only one of them across the core package? The
openapi.ts
typing does not include theunevaluated*
keywords required for OAS 3.1.x /JSON Schema 2020-12 schemas.I think this relates to https://github.com/Redocly/redocly-cli/issues/1546 where an unexpected keyword is throwing an error, but it is indeed valid for JSON Schema 2020-12 schemas to define any arbitrary properties.
In the previous version of OpenAPI 3.0.x, the schema object was strictly defined as a superset and subset of a JSON Schema draft-04 schema, and thus not all JSON Schema related behaviors applied. The interface design of
OAS3_1Schema
does not allow arbitrary properties.