@redocly/openapi-core 1.18.0 → 1.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/lib/bundle.d.ts +1 -1
- package/lib/bundle.js +1 -2
- package/lib/config/load.d.ts +1 -2
- package/lib/oas-types.d.ts +1 -1
- package/lib/rules/common/path-segment-plural.js +2 -1
- package/lib/types/arazzo.d.ts +1299 -73
- package/lib/types/arazzo.js +41 -36
- package/lib/types/asyncapi.js +17 -43
- package/lib/types/oas3_1.js +2 -2
- package/lib/typings/arazzo.d.ts +28 -1
- package/lib/utils.d.ts +8 -4
- package/lib/utils.js +38 -7
- package/package.json +2 -2
- package/src/__tests__/lint.test.ts +0 -50
- package/src/bundle.ts +2 -3
- package/src/config/load.ts +1 -2
- package/src/rules/common/__tests__/spec.test.ts +47 -0
- package/src/rules/common/no-invalid-schema-examples.ts +3 -2
- package/src/rules/common/path-segment-plural.ts +3 -2
- package/src/types/arazzo.ts +28 -23
- package/src/types/asyncapi.ts +22 -43
- package/src/types/oas3_1.ts +2 -2
- package/src/typings/arazzo.ts +41 -1
- package/src/utils.ts +41 -8
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# @redocly/openapi-core
|
|
2
2
|
|
|
3
|
+
## 1.18.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Allowed the `theme.openapi` configuration option to accept settings specific to Redoc 2.x and earlier.
|
|
8
|
+
- Fixed an issue in the OpenAPI `spec` rule where `dependentSchemas` was parsed as an array.
|
|
9
|
+
It is now correctly parsed as a map.
|
|
10
|
+
- Fixed bundling of `$refs` inside `patternProperties`.
|
|
11
|
+
- Updated AsyncAPI v2 typings to abide by JSON Schema draft-07 specification.
|
|
12
|
+
|
|
3
13
|
## 1.18.0
|
|
4
14
|
|
|
5
15
|
### Minor Changes
|
package/lib/bundle.d.ts
CHANGED
|
@@ -47,4 +47,4 @@ export declare function bundleDocument(opts: {
|
|
|
47
47
|
removeUnusedComponents?: boolean;
|
|
48
48
|
keepUrlRefs?: boolean;
|
|
49
49
|
}): Promise<BundleResult>;
|
|
50
|
-
export declare function mapTypeToComponent(typeName: string, version: SpecMajorVersion): "definitions" | "
|
|
50
|
+
export declare function mapTypeToComponent(typeName: string, version: SpecMajorVersion): "definitions" | "links" | "responses" | "parameters" | "examples" | "headers" | "schemas" | "requestBodies" | "securitySchemes" | "callbacks" | null;
|
package/lib/bundle.js
CHANGED
|
@@ -10,7 +10,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.mapTypeToComponent = exports.bundleDocument = exports.bundleFromString = exports.bundle = exports.bundleConfig = exports.OasVersion = void 0;
|
|
13
|
-
const isEqual = require("lodash.isequal");
|
|
14
13
|
const resolve_1 = require("./resolve");
|
|
15
14
|
const visitors_1 = require("./visitors");
|
|
16
15
|
const types_1 = require("./types");
|
|
@@ -332,7 +331,7 @@ function makeBundleVisitor(version, dereference, skipRedoclyRegistryRefs, rootDo
|
|
|
332
331
|
target.location.absolutePointer) {
|
|
333
332
|
return true;
|
|
334
333
|
}
|
|
335
|
-
return
|
|
334
|
+
return (0, utils_1.dequal)(node, target.node);
|
|
336
335
|
}
|
|
337
336
|
function getComponentName(target, componentType, ctx) {
|
|
338
337
|
const [fileRef, pointer] = [target.location.source.absoluteRef, target.location.pointer];
|
package/lib/config/load.d.ts
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { Config } from './config';
|
|
2
2
|
import { BaseResolver } from '../resolve';
|
|
3
|
-
import type { Document } from '../resolve';
|
|
3
|
+
import type { Document, ResolvedRefMap } from '../resolve';
|
|
4
4
|
import type { RegionalTokenWithValidity } from '../redocly/redocly-client-types';
|
|
5
5
|
import type { RawConfig, RawUniversalConfig, Region } from './types';
|
|
6
|
-
import type { ResolvedRefMap } from '../resolve';
|
|
7
6
|
export type RawConfigProcessor = (params: {
|
|
8
7
|
document: Document;
|
|
9
8
|
resolvedRefMap: ResolvedRefMap;
|
package/lib/oas-types.d.ts
CHANGED
|
@@ -29,4 +29,4 @@ export type Async2DecoratorsSet = Record<string, Async2Preprocessor>;
|
|
|
29
29
|
export type ArazzoDecoratorsSet = Record<string, ArazzoPreprocessor>;
|
|
30
30
|
export declare function detectSpec(root: any): SpecVersion;
|
|
31
31
|
export declare function getMajorSpecVersion(version: SpecVersion): SpecMajorVersion;
|
|
32
|
-
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" | "
|
|
32
|
+
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" | "TagList" | "SecurityRequirementList" | "ParameterList" | "TagGroup" | "TagGroups" | "EnumDescriptions" | "Logo" | "XCodeSample" | "XCodeSampleList" | "ServerList" | "XUsePkce" | "WebhooksMap", import("./types").NodeType> | Record<"Root" | "Info" | "License" | "Operation" | "Schema" | "SchemaProperties" | "Components" | "SecurityScheme" | "NamedPathItems" | "DependentRequired", import("./types").NodeType>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PathSegmentPlural = void 0;
|
|
4
|
+
const pluralize = require("pluralize");
|
|
4
5
|
const utils_1 = require("../../utils");
|
|
5
6
|
const PathSegmentPlural = (opts) => {
|
|
6
7
|
const { ignoreLastPathSegment, exceptions } = opts;
|
|
@@ -17,7 +18,7 @@ const PathSegmentPlural = (opts) => {
|
|
|
17
18
|
for (const pathSegment of pathSegments) {
|
|
18
19
|
if (exceptions && exceptions.includes(pathSegment))
|
|
19
20
|
continue;
|
|
20
|
-
if (!(0, utils_1.isPathParameter)(pathSegment) &&
|
|
21
|
+
if (!(0, utils_1.isPathParameter)(pathSegment) && pluralize.isSingular(pathSegment)) {
|
|
21
22
|
report({
|
|
22
23
|
message: `path segment \`${pathSegment}\` should be plural.`,
|
|
23
24
|
location: location.key(),
|