@redocly/openapi-core 1.4.0 → 1.5.0
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 +18 -0
- package/README.md +5 -5
- package/lib/bundle.js +2 -2
- package/lib/config/all.js +2 -0
- package/lib/config/minimal.js +2 -0
- package/lib/config/recommended-strict.js +2 -0
- package/lib/config/recommended.js +2 -0
- package/lib/decorators/oas2/remove-unused-components.d.ts +2 -0
- package/lib/decorators/oas3/remove-unused-components.d.ts +2 -0
- package/lib/env.js +1 -1
- package/lib/rules/oas3/array-parameter-serialization.d.ts +5 -0
- package/lib/rules/oas3/array-parameter-serialization.js +31 -0
- package/lib/rules/oas3/index.js +2 -0
- package/lib/types/oas3_1.js +12 -0
- package/lib/types/redocly-yaml.d.ts +1 -1
- package/lib/types/redocly-yaml.js +1 -0
- package/lib/typings/openapi.d.ts +1 -0
- package/lib/visitors.d.ts +7 -9
- package/package.json +1 -1
- package/src/bundle.ts +4 -4
- package/src/config/__tests__/__snapshots__/config-resolvers.test.ts.snap +4 -0
- package/src/config/all.ts +2 -0
- package/src/config/minimal.ts +2 -0
- package/src/config/recommended-strict.ts +2 -0
- package/src/config/recommended.ts +2 -0
- package/src/{rules → decorators}/oas2/remove-unused-components.ts +3 -3
- package/src/{rules → decorators}/oas3/remove-unused-components.ts +3 -3
- package/src/env.ts +1 -1
- package/src/rules/oas3/__tests__/array-parameter-serialization.test.ts +263 -0
- package/src/rules/oas3/array-parameter-serialization.ts +43 -0
- package/src/rules/oas3/index.ts +2 -0
- package/src/types/oas3_1.ts +12 -0
- package/src/types/redocly-yaml.ts +1 -0
- package/src/typings/openapi.ts +1 -0
- package/src/visitors.ts +7 -18
- package/tsconfig.tsbuildinfo +1 -1
- package/lib/rules/oas2/remove-unused-components.d.ts +0 -2
- package/lib/rules/oas3/remove-unused-components.d.ts +0 -2
- /package/lib/{rules → decorators}/oas2/remove-unused-components.js +0 -0
- /package/lib/{rules → decorators}/oas3/remove-unused-components.js +0 -0
- /package/src/{rules → decorators}/oas2/__tests__/remove-unused-components.test.ts +0 -0
- /package/src/{rules → decorators}/oas3/__tests__/remove-unused-components.test.ts +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @redocly/openapi-core
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Added new rule `array-parameter-serialization` to require that serialization parameters `style` and `explode` are present on array parameters.
|
|
8
|
+
|
|
9
|
+
## 1.4.1
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- 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.
|
|
14
|
+
|
|
15
|
+
In the new JSON Schema specification, each property value within a `properties` schema accepts a `boolean` or `object` schema.
|
|
16
|
+
|
|
17
|
+
https://json-schema.org/draft/2020-12/json-schema-core#section-10.3.2.1
|
|
18
|
+
|
|
19
|
+
- Fixed incorrect browser detection by removing check for 'self' as Bun also exposes it by default.
|
|
20
|
+
|
|
3
21
|
## 1.4.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/README.md
CHANGED
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
See https://github.com/Redocly/redocly-cli
|
|
4
4
|
|
|
5
5
|
> [!IMPORTANT]
|
|
6
|
-
The `openapi-core package` is designed for our internal use; the interfaces that are considered safe to use are documented below.
|
|
7
|
-
Some of the function arguments are not documented below because they are not intended for public use.
|
|
8
|
-
Avoid using any functions or features that are not documented below.
|
|
9
|
-
If your use case is not documented below, please open an issue.
|
|
6
|
+
> The `openapi-core package` is designed for our internal use; the interfaces that are considered safe to use are documented below.
|
|
7
|
+
> Some of the function arguments are not documented below because they are not intended for public use.
|
|
8
|
+
> Avoid using any functions or features that are not documented below.
|
|
9
|
+
> If your use case is not documented below, please open an issue.
|
|
10
10
|
|
|
11
11
|
## Basic usage
|
|
12
12
|
|
|
@@ -265,4 +265,4 @@ Helper function to stringify a javascript object to YAML.
|
|
|
265
265
|
|
|
266
266
|
```ts
|
|
267
267
|
function stringifyYaml(obj: object): string;
|
|
268
|
-
```
|
|
268
|
+
```
|
package/lib/bundle.js
CHANGED
|
@@ -21,8 +21,8 @@ const rules_1 = require("./config/rules");
|
|
|
21
21
|
const no_unresolved_refs_1 = require("./rules/no-unresolved-refs");
|
|
22
22
|
const utils_1 = require("./utils");
|
|
23
23
|
const redocly_1 = require("./redocly");
|
|
24
|
-
const remove_unused_components_1 = require("./
|
|
25
|
-
const remove_unused_components_2 = require("./
|
|
24
|
+
const remove_unused_components_1 = require("./decorators/oas2/remove-unused-components");
|
|
25
|
+
const remove_unused_components_2 = require("./decorators/oas3/remove-unused-components");
|
|
26
26
|
var OasVersion;
|
|
27
27
|
(function (OasVersion) {
|
|
28
28
|
OasVersion["Version2"] = "oas2";
|
package/lib/config/all.js
CHANGED
|
@@ -78,6 +78,7 @@ const all = {
|
|
|
78
78
|
'component-name-unique': 'error',
|
|
79
79
|
'response-contains-property': 'error',
|
|
80
80
|
'spec-components-invalid-map-name': 'error',
|
|
81
|
+
'array-parameter-serialization': 'error',
|
|
81
82
|
},
|
|
82
83
|
oas3_1Rules: {
|
|
83
84
|
'no-invalid-media-type-examples': 'error',
|
|
@@ -101,6 +102,7 @@ const all = {
|
|
|
101
102
|
'component-name-unique': 'error',
|
|
102
103
|
'response-contains-property': 'error',
|
|
103
104
|
'spec-components-invalid-map-name': 'error',
|
|
105
|
+
'array-parameter-serialization': 'error',
|
|
104
106
|
},
|
|
105
107
|
async2Rules: {
|
|
106
108
|
'channels-kebab-case': 'error',
|
package/lib/config/minimal.js
CHANGED
|
@@ -66,6 +66,7 @@ const minimal = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -83,6 +84,7 @@ const minimal = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
|
@@ -66,6 +66,7 @@ const recommendedStrict = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'error',
|
|
@@ -83,6 +84,7 @@ const recommendedStrict = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
|
@@ -66,6 +66,7 @@ const recommended = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -83,6 +84,7 @@ const recommended = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
package/lib/env.js
CHANGED
|
@@ -4,5 +4,5 @@ exports.env = exports.isBrowser = void 0;
|
|
|
4
4
|
exports.isBrowser =
|
|
5
5
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
6
6
|
// @ts-ignore
|
|
7
|
-
typeof window !== 'undefined' || typeof
|
|
7
|
+
typeof window !== 'undefined' || typeof process === 'undefined'; // main and worker thread
|
|
8
8
|
exports.env = exports.isBrowser ? {} : process.env || {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ArrayParameterSerialization = void 0;
|
|
4
|
+
const ref_utils_1 = require("../../ref-utils");
|
|
5
|
+
const ArrayParameterSerialization = (options) => {
|
|
6
|
+
return {
|
|
7
|
+
Parameter: {
|
|
8
|
+
leave(node, ctx) {
|
|
9
|
+
if (!node.schema) {
|
|
10
|
+
return;
|
|
11
|
+
}
|
|
12
|
+
const schema = (0, ref_utils_1.isRef)(node.schema)
|
|
13
|
+
? ctx.resolve(node.schema).node
|
|
14
|
+
: node.schema;
|
|
15
|
+
if (schema && shouldReportMissingStyleAndExplode(node, schema, options)) {
|
|
16
|
+
ctx.report({
|
|
17
|
+
message: `Parameter \`${node.name}\` should have \`style\` and \`explode \` fields`,
|
|
18
|
+
location: ctx.location,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
exports.ArrayParameterSerialization = ArrayParameterSerialization;
|
|
26
|
+
function shouldReportMissingStyleAndExplode(node, schema, options) {
|
|
27
|
+
var _a;
|
|
28
|
+
return ((schema.type === 'array' || schema.items || schema.prefixItems) &&
|
|
29
|
+
(node.style === undefined || node.explode === undefined) &&
|
|
30
|
+
(!options.in || (node.in && ((_a = options.in) === null || _a === void 0 ? void 0 : _a.includes(node.in)))));
|
|
31
|
+
}
|
package/lib/rules/oas3/index.js
CHANGED
|
@@ -54,6 +54,7 @@ const operation_4xx_problem_details_rfc7807_1 = require("./operation-4xx-problem
|
|
|
54
54
|
const required_string_property_missing_min_length_1 = require("../common/required-string-property-missing-min-length");
|
|
55
55
|
const spec_strict_refs_1 = require("../common/spec-strict-refs");
|
|
56
56
|
const component_name_unique_1 = require("./component-name-unique");
|
|
57
|
+
const array_parameter_serialization_1 = require("./array-parameter-serialization");
|
|
57
58
|
exports.rules = {
|
|
58
59
|
spec: spec_1.Spec,
|
|
59
60
|
'info-contact': info_contact_1.InfoContact,
|
|
@@ -109,5 +110,6 @@ exports.rules = {
|
|
|
109
110
|
'required-string-property-missing-min-length': required_string_property_missing_min_length_1.RequiredStringPropertyMissingMinLength,
|
|
110
111
|
'spec-strict-refs': spec_strict_refs_1.SpecStrictRefs,
|
|
111
112
|
'component-name-unique': component_name_unique_1.ComponentNameUnique,
|
|
113
|
+
'array-parameter-serialization': array_parameter_serialization_1.ArrayParameterSerialization,
|
|
112
114
|
};
|
|
113
115
|
exports.preprocessors = {};
|
package/lib/types/oas3_1.js
CHANGED
|
@@ -181,6 +181,17 @@ const Schema = {
|
|
|
181
181
|
},
|
|
182
182
|
extensionsPrefix: 'x-',
|
|
183
183
|
};
|
|
184
|
+
const SchemaProperties = {
|
|
185
|
+
properties: {},
|
|
186
|
+
additionalProperties: (value) => {
|
|
187
|
+
if (typeof value === 'boolean') {
|
|
188
|
+
return { type: 'boolean' };
|
|
189
|
+
}
|
|
190
|
+
else {
|
|
191
|
+
return 'Schema';
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
};
|
|
184
195
|
const SecurityScheme = {
|
|
185
196
|
properties: {
|
|
186
197
|
type: { enum: ['apiKey', 'http', 'oauth2', 'openIdConnect', 'mutualTLS'] },
|
|
@@ -253,6 +264,7 @@ const SecurityScheme = {
|
|
|
253
264
|
exports.Oas3_1Types = Object.assign(Object.assign({}, oas3_1.Oas3Types), { Info,
|
|
254
265
|
Root,
|
|
255
266
|
Schema,
|
|
267
|
+
SchemaProperties,
|
|
256
268
|
License,
|
|
257
269
|
Components, NamedPathItems: (0, _1.mapOf)('PathItem'), SecurityScheme,
|
|
258
270
|
Operation });
|
|
@@ -5,7 +5,7 @@ declare const builtInCommonOASRules: readonly ["info-license-url", "info-license
|
|
|
5
5
|
export type BuiltInCommonOASRuleId = typeof builtInCommonOASRules[number];
|
|
6
6
|
declare const builtInOAS2Rules: readonly ["boolean-parameter-prefixes", "request-mime-type", "response-contains-property", "response-mime-type"];
|
|
7
7
|
export type BuiltInOAS2RuleId = typeof builtInOAS2Rules[number];
|
|
8
|
-
declare const builtInOAS3Rules: readonly ["boolean-parameter-prefixes", "component-name-unique", "no-empty-servers", "no-example-value-and-externalValue", "no-invalid-media-type-examples", "no-server-example.com", "no-server-trailing-slash", "no-server-variables-empty-enum", "no-undefined-server-variable", "no-unused-components", "operation-4xx-problem-details-rfc7807", "request-mime-type", "response-contains-property", "response-mime-type", "spec-components-invalid-map-name"];
|
|
8
|
+
declare const builtInOAS3Rules: readonly ["boolean-parameter-prefixes", "component-name-unique", "no-empty-servers", "no-example-value-and-externalValue", "no-invalid-media-type-examples", "no-server-example.com", "no-server-trailing-slash", "no-server-variables-empty-enum", "no-undefined-server-variable", "no-unused-components", "operation-4xx-problem-details-rfc7807", "request-mime-type", "response-contains-property", "response-mime-type", "spec-components-invalid-map-name", "array-parameter-serialization"];
|
|
9
9
|
export type BuiltInOAS3RuleId = typeof builtInOAS3Rules[number];
|
|
10
10
|
declare const builtInAsync2Rules: readonly ["channels-kebab-case", "no-channel-trailing-slash"];
|
|
11
11
|
export type BuiltInAsync2RuleId = typeof builtInAsync2Rules[number];
|
|
@@ -70,6 +70,7 @@ const builtInOAS3Rules = [
|
|
|
70
70
|
'response-contains-property',
|
|
71
71
|
'response-mime-type',
|
|
72
72
|
'spec-components-invalid-map-name',
|
|
73
|
+
'array-parameter-serialization',
|
|
73
74
|
];
|
|
74
75
|
const builtInAsync2Rules = ['channels-kebab-case', 'no-channel-trailing-slash'];
|
|
75
76
|
const builtInRules = [
|
package/lib/typings/openapi.d.ts
CHANGED
|
@@ -150,6 +150,7 @@ export interface Oas3Schema {
|
|
|
150
150
|
export type Oas3_1Schema = Oas3Schema & {
|
|
151
151
|
type?: string | string[];
|
|
152
152
|
examples?: any[];
|
|
153
|
+
prefixItems?: Oas3_1Schema[];
|
|
153
154
|
};
|
|
154
155
|
export interface Oas3_1Definition extends Oas3Definition {
|
|
155
156
|
webhooks?: Oas3_1Webhooks;
|
package/lib/visitors.d.ts
CHANGED
|
@@ -133,6 +133,7 @@ type Oas2FlatVisitor = {
|
|
|
133
133
|
NamedResponses?: VisitFunctionOrObject<Record<string, Oas2Response>>;
|
|
134
134
|
NamedParameters?: VisitFunctionOrObject<Record<string, Oas2Parameter>>;
|
|
135
135
|
SecurityScheme?: VisitFunctionOrObject<Oas2SecurityScheme>;
|
|
136
|
+
NamedSecuritySchemes?: VisitFunctionOrObject<Record<string, Oas2SecurityScheme>>;
|
|
136
137
|
SpecExtension?: VisitFunctionOrObject<unknown>;
|
|
137
138
|
};
|
|
138
139
|
type Async2FlatVisitor = {
|
|
@@ -150,9 +151,6 @@ type Async2NestedVisitor = {
|
|
|
150
151
|
export type Oas3Visitor = BaseVisitor & Oas3NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas3NestedVisitor>>;
|
|
151
152
|
export type Oas2Visitor = BaseVisitor & Oas2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Oas2NestedVisitor>>;
|
|
152
153
|
export type Async2Visitor = BaseVisitor & Async2NestedVisitor & Record<string, VisitFunction<any> | NestedVisitObject<any, Async2NestedVisitor>>;
|
|
153
|
-
export type Oas3TransformVisitor = BaseVisitor & Oas3FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
|
|
154
|
-
export type Oas2TransformVisitor = BaseVisitor & Oas2FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
|
|
155
|
-
export type Async2TransformVisitor = BaseVisitor & Async2FlatVisitor & Record<string, VisitFunction<any> | VisitObject<any>>;
|
|
156
154
|
export type NestedVisitor<T> = Exclude<T, 'any' | 'ref' | 'Root'>;
|
|
157
155
|
export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
|
158
156
|
[V in keyof T]-?: {
|
|
@@ -172,12 +170,12 @@ export type NormalizedOasVisitors<T extends BaseVisitor> = {
|
|
|
172
170
|
export type Oas3Rule = (options: Record<string, any>) => Oas3Visitor | Oas3Visitor[];
|
|
173
171
|
export type Oas2Rule = (options: Record<string, any>) => Oas2Visitor | Oas2Visitor[];
|
|
174
172
|
export type Async2Rule = (options: Record<string, any>) => Async2Visitor | Async2Visitor[];
|
|
175
|
-
export type Oas3Preprocessor = (options: Record<string, any>) =>
|
|
176
|
-
export type Oas2Preprocessor = (options: Record<string, any>) =>
|
|
177
|
-
export type Async2Preprocessor = (options: Record<string, any>) =>
|
|
178
|
-
export type Oas3Decorator = (options: Record<string, any>) =>
|
|
179
|
-
export type Oas2Decorator = (options: Record<string, any>) =>
|
|
180
|
-
export type Async2Decorator = (options: Record<string, any>) =>
|
|
173
|
+
export type Oas3Preprocessor = (options: Record<string, any>) => Oas3Visitor;
|
|
174
|
+
export type Oas2Preprocessor = (options: Record<string, any>) => Oas2Visitor;
|
|
175
|
+
export type Async2Preprocessor = (options: Record<string, any>) => Async2Visitor;
|
|
176
|
+
export type Oas3Decorator = (options: Record<string, any>) => Oas3Visitor;
|
|
177
|
+
export type Oas2Decorator = (options: Record<string, any>) => Oas2Visitor;
|
|
178
|
+
export type Async2Decorator = (options: Record<string, any>) => Async2Visitor;
|
|
181
179
|
export type OasRule = Oas3Rule;
|
|
182
180
|
export type OasPreprocessor = Oas3Preprocessor;
|
|
183
181
|
export type OasDecorator = Oas3Decorator;
|
package/package.json
CHANGED
package/src/bundle.ts
CHANGED
|
@@ -17,8 +17,8 @@ import { reportUnresolvedRef } from './rules/no-unresolved-refs';
|
|
|
17
17
|
import { isPlainObject, isTruthy } from './utils';
|
|
18
18
|
import { OasRef } from './typings/openapi';
|
|
19
19
|
import { isRedoclyRegistryURL } from './redocly';
|
|
20
|
-
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './
|
|
21
|
-
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './
|
|
20
|
+
import { RemoveUnusedComponents as RemoveUnusedComponentsOas2 } from './decorators/oas2/remove-unused-components';
|
|
21
|
+
import { RemoveUnusedComponents as RemoveUnusedComponentsOas3 } from './decorators/oas3/remove-unused-components';
|
|
22
22
|
|
|
23
23
|
import type { Config, StyleguideConfig } from './config';
|
|
24
24
|
|
|
@@ -126,8 +126,8 @@ export async function bundleDocument(opts: {
|
|
|
126
126
|
config
|
|
127
127
|
);
|
|
128
128
|
|
|
129
|
-
const preprocessors = initRules(rules
|
|
130
|
-
const decorators = initRules(rules
|
|
129
|
+
const preprocessors = initRules(rules, config, 'preprocessors', specVersion);
|
|
130
|
+
const decorators = initRules(rules, config, 'decorators', specVersion);
|
|
131
131
|
|
|
132
132
|
const ctx: BundleContext = {
|
|
133
133
|
problems: [],
|
|
@@ -21,6 +21,7 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
|
|
|
21
21
|
"oas3_0Decorators": {},
|
|
22
22
|
"oas3_0Preprocessors": {},
|
|
23
23
|
"oas3_0Rules": {
|
|
24
|
+
"array-parameter-serialization": "off",
|
|
24
25
|
"boolean-parameter-prefixes": "error",
|
|
25
26
|
"component-name-unique": "off",
|
|
26
27
|
"no-empty-servers": "error",
|
|
@@ -40,6 +41,7 @@ exports[`resolveConfig should ignore minimal from the root and read local file 1
|
|
|
40
41
|
"oas3_1Decorators": {},
|
|
41
42
|
"oas3_1Preprocessors": {},
|
|
42
43
|
"oas3_1Rules": {
|
|
44
|
+
"array-parameter-serialization": "off",
|
|
43
45
|
"boolean-parameter-prefixes": "error",
|
|
44
46
|
"component-name-unique": "off",
|
|
45
47
|
"no-empty-servers": "error",
|
|
@@ -125,6 +127,7 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
|
|
|
125
127
|
"oas3_0Decorators": {},
|
|
126
128
|
"oas3_0Preprocessors": {},
|
|
127
129
|
"oas3_0Rules": {
|
|
130
|
+
"array-parameter-serialization": "off",
|
|
128
131
|
"boolean-parameter-prefixes": "error",
|
|
129
132
|
"component-name-unique": "off",
|
|
130
133
|
"no-empty-servers": "error",
|
|
@@ -144,6 +147,7 @@ exports[`resolveStyleguideConfig should resolve extends with local file config w
|
|
|
144
147
|
"oas3_1Decorators": {},
|
|
145
148
|
"oas3_1Preprocessors": {},
|
|
146
149
|
"oas3_1Rules": {
|
|
150
|
+
"array-parameter-serialization": "off",
|
|
147
151
|
"boolean-parameter-prefixes": "error",
|
|
148
152
|
"component-name-unique": "off",
|
|
149
153
|
"no-empty-servers": "error",
|
package/src/config/all.ts
CHANGED
|
@@ -78,6 +78,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
78
78
|
'component-name-unique': 'error',
|
|
79
79
|
'response-contains-property': 'error',
|
|
80
80
|
'spec-components-invalid-map-name': 'error',
|
|
81
|
+
'array-parameter-serialization': 'error',
|
|
81
82
|
},
|
|
82
83
|
oas3_1Rules: {
|
|
83
84
|
'no-invalid-media-type-examples': 'error',
|
|
@@ -101,6 +102,7 @@ const all: PluginStyleguideConfig<'built-in'> = {
|
|
|
101
102
|
'component-name-unique': 'error',
|
|
102
103
|
'response-contains-property': 'error',
|
|
103
104
|
'spec-components-invalid-map-name': 'error',
|
|
105
|
+
'array-parameter-serialization': 'error',
|
|
104
106
|
},
|
|
105
107
|
async2Rules: {
|
|
106
108
|
'channels-kebab-case': 'error',
|
package/src/config/minimal.ts
CHANGED
|
@@ -66,6 +66,7 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -83,6 +84,7 @@ const minimal: PluginStyleguideConfig<'built-in'> = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
|
@@ -66,6 +66,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'error',
|
|
@@ -83,6 +84,7 @@ const recommendedStrict: PluginStyleguideConfig<'built-in'> = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
|
@@ -66,6 +66,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
|
|
|
66
66
|
'request-mime-type': 'off',
|
|
67
67
|
'response-contains-property': 'off',
|
|
68
68
|
'response-mime-type': 'off',
|
|
69
|
+
'array-parameter-serialization': 'off',
|
|
69
70
|
},
|
|
70
71
|
oas3_1Rules: {
|
|
71
72
|
'no-invalid-media-type-examples': 'warn',
|
|
@@ -83,6 +84,7 @@ const recommended: PluginStyleguideConfig<'built-in'> = {
|
|
|
83
84
|
'request-mime-type': 'off',
|
|
84
85
|
'response-contains-property': 'off',
|
|
85
86
|
'response-mime-type': 'off',
|
|
87
|
+
'array-parameter-serialization': 'off',
|
|
86
88
|
},
|
|
87
89
|
async2Rules: {
|
|
88
90
|
'channels-kebab-case': 'off',
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Oas2Decorator } from '../../visitors';
|
|
2
2
|
import { Location } from '../../ref-utils';
|
|
3
|
-
import { Oas2Components } from '../../typings/swagger';
|
|
3
|
+
import type { Oas2Components } from '../../typings/swagger';
|
|
4
4
|
import { isEmptyObject } from '../../utils';
|
|
5
5
|
|
|
6
|
-
export const RemoveUnusedComponents:
|
|
6
|
+
export const RemoveUnusedComponents: Oas2Decorator = () => {
|
|
7
7
|
const components = new Map<
|
|
8
8
|
string,
|
|
9
9
|
{ used: boolean; componentType?: keyof Oas2Components; name: string }
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Oas3Decorator } from '../../visitors';
|
|
2
2
|
import { Location } from '../../ref-utils';
|
|
3
|
-
import { Oas3Components } from '../../typings/openapi';
|
|
3
|
+
import type { Oas3Components } from '../../typings/openapi';
|
|
4
4
|
import { isEmptyObject } from '../../utils';
|
|
5
5
|
|
|
6
|
-
export const RemoveUnusedComponents:
|
|
6
|
+
export const RemoveUnusedComponents: Oas3Decorator = () => {
|
|
7
7
|
const components = new Map<
|
|
8
8
|
string,
|
|
9
9
|
{ used: boolean; componentType?: keyof Oas3Components; name: string }
|
package/src/env.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export const isBrowser =
|
|
2
2
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
3
3
|
// @ts-ignore
|
|
4
|
-
typeof window !== 'undefined' || typeof
|
|
4
|
+
typeof window !== 'undefined' || typeof process === 'undefined'; // main and worker thread
|
|
5
5
|
export const env = isBrowser ? {} : process.env || {};
|