mirror of
https://github.com/LukeHagar/redocly-cli.git
synced 2025-12-09 20:57:44 +00:00
OAS3_1 types SchemaProperties updated per JSON Schema draft 2020-12 (#1310)
This commit is contained in:
9
.changeset/short-poets-sleep.md
Normal file
9
.changeset/short-poets-sleep.md
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
'@redocly/openapi-core': patch
|
||||
---
|
||||
|
||||
OpenAPI 3.1.x defaults to JSON Schema draft 2020-12 and the value of property names defined in `properties` was updated since OpenAPI 3.0.x and JSON Schema draft-04.
|
||||
|
||||
In the new JSON Schema specification, each property value within a `properties` schema accepts a `boolean` or `object` schema.
|
||||
|
||||
https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.1
|
||||
@@ -181,6 +181,17 @@ const Schema: NodeType = {
|
||||
extensionsPrefix: 'x-',
|
||||
};
|
||||
|
||||
const SchemaProperties: NodeType = {
|
||||
properties: {},
|
||||
additionalProperties: (value: any) => {
|
||||
if (typeof value === 'boolean') {
|
||||
return { type: 'boolean' };
|
||||
} else {
|
||||
return 'Schema';
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
const SecurityScheme: NodeType = {
|
||||
properties: {
|
||||
type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect', 'mutualTLS'] },
|
||||
@@ -256,6 +267,7 @@ export const Oas3_1Types: Record<string, NodeType> = {
|
||||
Info,
|
||||
Root,
|
||||
Schema,
|
||||
SchemaProperties,
|
||||
License,
|
||||
Components,
|
||||
NamedPathItems: mapOf('PathItem'),
|
||||
|
||||
Reference in New Issue
Block a user