@redocly/openapi-core
Advanced tools
Comparing version 1.17.0 to 1.17.1
# @redocly/openapi-core | ||
## 1.17.1 | ||
### Patch Changes | ||
- Added JSON Schema draft 2019-09+ validation keyword - `dependentRequired`. | ||
- Updated @redocly/config to v0.6.2. | ||
## 1.17.0 | ||
@@ -4,0 +11,0 @@ |
@@ -27,2 +27,2 @@ import { Oas3Rule, Oas3Preprocessor, Oas2Rule, Oas2Preprocessor, Async2Preprocessor, Async2Rule } from './visitors'; | ||
export declare function getMajorSpecVersion(version: SpecVersion): SpecMajorVersion; | ||
export declare function getTypes(spec: SpecVersion): Record<string, import("./types").NodeType> | Record<"Root" | "Tag" | "ExternalDocs" | "SecurityRequirement" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "Operation" | "Example" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "Examples" | "ExamplesMap" | "TagList" | "SecurityRequirementList" | "ParameterList" | "ParameterItems" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "XServer" | "XServerList", import("./types").NodeType> | Record<"Root" | "Tag" | "ExternalDocs" | "Server" | "ServerVariable" | "SecurityRequirement" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Callback" | "CallbacksMap" | "Parameter" | "Operation" | "RequestBody" | "MediaTypesMap" | "MediaType" | "Example" | "Encoding" | "Header" | "Responses" | "Response" | "Link" | "Schema" | "Xml" | "SchemaProperties" | "DiscriminatorMapping" | "Discriminator" | "Components" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedExamples" | "NamedRequestBodies" | "NamedHeaders" | "NamedSecuritySchemes" | "NamedLinks" | "NamedCallbacks" | "ImplicitFlow" | "PasswordFlow" | "ClientCredentials" | "AuthorizationCode" | "OAuth2Flows" | "SecurityScheme" | "ServerVariablesMap" | "ExamplesMap" | "EncodingMap" | "HeadersMap" | "LinksMap" | "WebhooksMap" | "TagList" | "SecurityRequirementList" | "ParameterList" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "ServerList" | "XUsePkce", import("./types").NodeType> | Record<"Root" | "Info" | "License" | "Operation" | "Schema" | "SchemaProperties" | "Components" | "SecurityScheme" | "NamedPathItems", import("./types").NodeType>; | ||
export declare function getTypes(spec: SpecVersion): Record<string, import("./types").NodeType> | Record<"Root" | "Tag" | "ExternalDocs" | "SecurityRequirement" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Parameter" | "Operation" | "Example" | "Header" | "Responses" | "Response" | "Schema" | "Xml" | "SchemaProperties" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedSecuritySchemes" | "SecurityScheme" | "Examples" | "ExamplesMap" | "TagList" | "SecurityRequirementList" | "ParameterList" | "ParameterItems" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "XServer" | "XServerList", import("./types").NodeType> | Record<"Root" | "Tag" | "ExternalDocs" | "Server" | "ServerVariable" | "SecurityRequirement" | "Info" | "Contact" | "License" | "Paths" | "PathItem" | "Callback" | "CallbacksMap" | "Parameter" | "Operation" | "RequestBody" | "MediaTypesMap" | "MediaType" | "Example" | "Encoding" | "Header" | "Responses" | "Response" | "Link" | "Schema" | "Xml" | "SchemaProperties" | "DiscriminatorMapping" | "Discriminator" | "Components" | "NamedSchemas" | "NamedResponses" | "NamedParameters" | "NamedExamples" | "NamedRequestBodies" | "NamedHeaders" | "NamedSecuritySchemes" | "NamedLinks" | "NamedCallbacks" | "ImplicitFlow" | "PasswordFlow" | "ClientCredentials" | "AuthorizationCode" | "OAuth2Flows" | "SecurityScheme" | "ServerVariablesMap" | "ExamplesMap" | "EncodingMap" | "HeadersMap" | "LinksMap" | "WebhooksMap" | "TagList" | "SecurityRequirementList" | "ParameterList" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "ServerList" | "XUsePkce", import("./types").NodeType> | Record<"Root" | "Info" | "License" | "Operation" | "Schema" | "SchemaProperties" | "Components" | "SecurityScheme" | "NamedPathItems" | "DependentRequired", import("./types").NodeType>; |
@@ -132,2 +132,3 @@ "use strict"; | ||
dependentSchemas: (0, _1.listOf)('Schema'), | ||
dependentRequired: 'DependentRequired', | ||
prefixItems: (0, _1.listOf)('Schema'), | ||
@@ -266,2 +267,6 @@ contains: 'Schema', | ||
}; | ||
const DependentRequired = { | ||
properties: {}, | ||
additionalProperties: { type: 'array', items: { type: 'string' } }, | ||
}; | ||
exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info, | ||
@@ -273,2 +278,3 @@ Root, | ||
Components, NamedPathItems: (0, _1.mapOf)('PathItem'), SecurityScheme, | ||
Operation }); | ||
Operation, | ||
DependentRequired }); |
@@ -18,3 +18,3 @@ import type { NodeType } from '.'; | ||
export type Oas3NodeType = typeof oas3NodeTypesList[number]; | ||
declare const oas3_1NodeTypesList: readonly ["Root", "Schema", "SchemaProperties", "Info", "License", "Components", "NamedPathItems", "SecurityScheme", "Operation"]; | ||
declare const oas3_1NodeTypesList: readonly ["Root", "Schema", "SchemaProperties", "Info", "License", "Components", "NamedPathItems", "SecurityScheme", "Operation", "DependentRequired"]; | ||
export type Oas3_1NodeType = typeof oas3_1NodeTypesList[number]; | ||
@@ -21,0 +21,0 @@ export declare function createConfigTypes(extraSchemas: JSONSchema, config?: Config): { |
@@ -197,2 +197,3 @@ "use strict"; | ||
'Operation', | ||
'DependentRequired', | ||
]; | ||
@@ -199,0 +200,0 @@ const ConfigStyleguide = { |
{ | ||
"name": "@redocly/openapi-core", | ||
"version": "1.17.0", | ||
"version": "1.17.1", | ||
"description": "", | ||
@@ -39,3 +39,3 @@ "main": "lib/index.js", | ||
"@redocly/ajv": "^8.11.0", | ||
"@redocly/config": "^0.6.0", | ||
"@redocly/config": "^0.6.2", | ||
"colorette": "^1.2.0", | ||
@@ -42,0 +42,0 @@ "https-proxy-agent": "^7.0.4", |
@@ -1596,2 +1596,126 @@ import * as path from 'path'; | ||
}); | ||
it('should throw an error for dependentRequired not expected here - OAS 3.0.x', async () => { | ||
const document = parseYamlToDocument( | ||
outdent` | ||
openapi: 3.0.3 | ||
info: | ||
title: test json schema validation keyword - dependentRequired | ||
version: 1.0.0 | ||
paths: | ||
'/thing': | ||
get: | ||
summary: a sample api | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/test_schema' | ||
examples: | ||
dependentRequired_passing: | ||
summary: an example schema | ||
value: { "name": "bobby", "age": 25} | ||
dependentRequired_failing: | ||
summary: an example schema | ||
value: { "name": "jennie"} | ||
components: | ||
schemas: | ||
test_schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: number | ||
dependentRequired: | ||
name: | ||
- age | ||
`, | ||
'' | ||
); | ||
const configFilePath = path.join(__dirname, '..', '..', '..', 'redocly.yaml'); | ||
const results = await lintDocument({ | ||
externalRefResolver: new BaseResolver(), | ||
document, | ||
config: await makeConfig({ spec: 'error' }, undefined, configFilePath), | ||
}); | ||
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(` | ||
[ | ||
{ | ||
"from": { | ||
"pointer": "#/paths/~1thing/get/responses/200/content/application~1json/schema", | ||
"source": "", | ||
}, | ||
"location": [ | ||
{ | ||
"pointer": "#/components/schemas/test_schema/dependentRequired", | ||
"reportOnKey": true, | ||
"source": "", | ||
}, | ||
], | ||
"message": "Property \`dependentRequired\` is not expected here.", | ||
"ruleId": "spec", | ||
"severity": "error", | ||
"suggest": [], | ||
}, | ||
] | ||
`); | ||
}); | ||
it('should not throw an error for dependentRequired not expected here - OAS 3.1.x', async () => { | ||
const document = parseYamlToDocument( | ||
outdent` | ||
openapi: 3.1.0 | ||
info: | ||
title: test json schema validation keyword - dependentRequired | ||
version: 1.0.0 | ||
paths: | ||
'/thing': | ||
get: | ||
summary: a sample api | ||
responses: | ||
'200': | ||
description: OK | ||
content: | ||
'application/json': | ||
schema: | ||
$ref: '#/components/schemas/test_schema' | ||
examples: | ||
dependentRequired_passing: | ||
summary: an example schema | ||
value: { "name": "bobby", "age": 25} | ||
dependentRequired_failing: | ||
summary: an example schema | ||
value: { "name": "jennie"} | ||
components: | ||
schemas: | ||
test_schema: | ||
type: object | ||
properties: | ||
name: | ||
type: string | ||
age: | ||
type: number | ||
dependentRequired: | ||
name: | ||
- age | ||
`, | ||
'' | ||
); | ||
const configFilePath = path.join(__dirname, '..', '..', '..', 'redocly.yaml'); | ||
const results = await lintDocument({ | ||
externalRefResolver: new BaseResolver(), | ||
document, | ||
config: await makeConfig({ spec: 'error' }, undefined, configFilePath), | ||
}); | ||
expect(replaceSourceWithRef(results)).toMatchInlineSnapshot(`[]`); | ||
}); | ||
}); |
@@ -137,2 +137,3 @@ import { listOf, mapOf } from '.'; | ||
dependentSchemas: listOf('Schema'), | ||
dependentRequired: 'DependentRequired', | ||
prefixItems: listOf('Schema'), | ||
@@ -270,2 +271,7 @@ contains: 'Schema', | ||
const DependentRequired: NodeType = { | ||
properties: {}, | ||
additionalProperties: { type: 'array', items: { type: 'string' } }, | ||
}; | ||
export const Oas3_1Types: Record<Oas3_1NodeType, NodeType> = { | ||
@@ -282,2 +288,3 @@ ...Oas3Types, | ||
Operation, | ||
DependentRequired, | ||
}; |
@@ -223,2 +223,3 @@ import { rootRedoclyConfigSchema } from '@redocly/config'; | ||
'Operation', | ||
'DependentRequired', | ||
] as const; | ||
@@ -225,0 +226,0 @@ |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2828045
48012
Updated@redocly/config@^0.6.2