@openlint/ruleset-spectral-oas 0.0.0-stage → 1.0.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/LICENSE +191 -0
- package/README.md +11 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/oas/functions/index.d.ts +15 -0
- package/dist/oas/functions/index.js +33 -0
- package/dist/oas/functions/index.js.map +1 -0
- package/dist/oas/functions/oasDiscriminator.d.ts +6 -0
- package/dist/oas/functions/oasDiscriminator.js +39 -0
- package/dist/oas/functions/oasDiscriminator.js.map +1 -0
- package/dist/oas/functions/oasDocumentSchema.d.ts +2 -0
- package/dist/oas/functions/oasDocumentSchema.js +104 -0
- package/dist/oas/functions/oasDocumentSchema.js.map +1 -0
- package/dist/oas/functions/oasExample.d.ts +7 -0
- package/dist/oas/functions/oasExample.js +217 -0
- package/dist/oas/functions/oasExample.js.map +1 -0
- package/dist/oas/functions/oasOpFormDataConsumeCheck.d.ts +6 -0
- package/dist/oas/functions/oasOpFormDataConsumeCheck.js +30 -0
- package/dist/oas/functions/oasOpFormDataConsumeCheck.js.map +1 -0
- package/dist/oas/functions/oasOpIdUnique.d.ts +2 -0
- package/dist/oas/functions/oasOpIdUnique.js +35 -0
- package/dist/oas/functions/oasOpIdUnique.js.map +1 -0
- package/dist/oas/functions/oasOpParams.d.ts +2 -0
- package/dist/oas/functions/oasOpParams.js +75 -0
- package/dist/oas/functions/oasOpParams.js.map +1 -0
- package/dist/oas/functions/oasOpSuccessResponse.d.ts +2 -0
- package/dist/oas/functions/oasOpSuccessResponse.js +27 -0
- package/dist/oas/functions/oasOpSuccessResponse.js.map +1 -0
- package/dist/oas/functions/oasPathParam.d.ts +2 -0
- package/dist/oas/functions/oasPathParam.js +135 -0
- package/dist/oas/functions/oasPathParam.js.map +1 -0
- package/dist/oas/functions/oasSchema.d.ts +5 -0
- package/dist/oas/functions/oasSchema.js +81 -0
- package/dist/oas/functions/oasSchema.js.map +1 -0
- package/dist/oas/functions/oasSecurityDefined.d.ts +5 -0
- package/dist/oas/functions/oasSecurityDefined.js +76 -0
- package/dist/oas/functions/oasSecurityDefined.js.map +1 -0
- package/dist/oas/functions/oasTagDefined.d.ts +2 -0
- package/dist/oas/functions/oasTagDefined.js +42 -0
- package/dist/oas/functions/oasTagDefined.js.map +1 -0
- package/dist/oas/functions/oasUnusedComponent.d.ts +4 -0
- package/dist/oas/functions/oasUnusedComponent.js +40 -0
- package/dist/oas/functions/oasUnusedComponent.js.map +1 -0
- package/dist/oas/functions/refSiblings.d.ts +2 -0
- package/dist/oas/functions/refSiblings.js +42 -0
- package/dist/oas/functions/refSiblings.js.map +1 -0
- package/dist/oas/functions/typedEnum.d.ts +7 -0
- package/dist/oas/functions/typedEnum.js +76 -0
- package/dist/oas/functions/typedEnum.js.map +1 -0
- package/dist/oas/functions/utils/getAllOperations.d.ts +7 -0
- package/dist/oas/functions/utils/getAllOperations.js +31 -0
- package/dist/oas/functions/utils/getAllOperations.js.map +1 -0
- package/dist/oas/functions/utils/isObject.d.ts +2 -0
- package/dist/oas/functions/utils/isObject.js +7 -0
- package/dist/oas/functions/utils/isObject.js.map +1 -0
- package/dist/oas/index.d.ts +733 -0
- package/dist/oas/index.js +765 -0
- package/dist/oas/index.js.map +1 -0
- package/dist/oas/schemas/__fixtures__/validate.d.ts +1 -0
- package/dist/oas/schemas/__fixtures__/validate.js +3 -0
- package/dist/oas/schemas/__fixtures__/validate.js.map +1 -0
- package/dist/oas/schemas/json-schema/draft-04.json +137 -0
- package/dist/oas/schemas/json-schema/draft-2020-12/index.json +54 -0
- package/dist/oas/schemas/json-schema/draft-2020-12/validation.json +101 -0
- package/dist/oas/schemas/oas/v2.0.json +1478 -0
- package/dist/oas/schemas/oas/v3.0.json +1652 -0
- package/dist/oas/schemas/oas/v3.1/dialect.schema.json +35 -0
- package/dist/oas/schemas/oas/v3.1/index.json +1276 -0
- package/dist/oas/schemas/oas/v3.1/meta.schema.json +93 -0
- package/dist/oas/schemas/oas/v3.2/dialect.schema.json +25 -0
- package/dist/oas/schemas/oas/v3.2/index.json +1527 -0
- package/dist/oas/schemas/oas/v3.2/meta.schema.json +103 -0
- package/dist/oas/schemas/validators.d.ts +66 -0
- package/dist/oas/schemas/validators.js +12991 -0
- package/dist/oas/schemas/validators.js.map +1 -0
- package/dist/shared/functions/index.d.ts +2 -0
- package/dist/shared/functions/index.js +7 -0
- package/dist/shared/functions/index.js.map +1 -0
- package/dist/shared/functions/serverVariables/index.d.ts +16 -0
- package/dist/shared/functions/serverVariables/index.js +154 -0
- package/dist/shared/functions/serverVariables/index.js.map +1 -0
- package/dist/shared/functions/serverVariables/utils/applyUrlVariables.d.ts +3 -0
- package/dist/shared/functions/serverVariables/utils/applyUrlVariables.js +32 -0
- package/dist/shared/functions/serverVariables/utils/applyUrlVariables.js.map +1 -0
- package/dist/shared/functions/serverVariables/utils/parseUrlVariables.d.ts +1 -0
- package/dist/shared/functions/serverVariables/utils/parseUrlVariables.js +12 -0
- package/dist/shared/functions/serverVariables/utils/parseUrlVariables.js.map +1 -0
- package/dist/shared/functions/uniquenessTags.d.ts +5 -0
- package/dist/shared/functions/uniquenessTags.js +42 -0
- package/dist/shared/functions/uniquenessTags.js.map +1 -0
- package/dist/shared/utils/getMissingProps.d.ts +1 -0
- package/dist/shared/utils/getMissingProps.js +9 -0
- package/dist/shared/utils/getMissingProps.js.map +1 -0
- package/dist/shared/utils/getRedundantProps.d.ts +1 -0
- package/dist/shared/utils/getRedundantProps.js +9 -0
- package/dist/shared/utils/getRedundantProps.js.map +1 -0
- package/package.json +47 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2018 Stoplight, Inc.
|
|
179
|
+
Copyright 2026 OpenLint
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Legacy Spectral OpenAPI ruleset
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This package preserves the complete legacy `spectral:oas` ruleset, including
|
|
4
|
+
the documentation-style rules that are not part of the OpenLint OpenAPI core
|
|
5
|
+
ruleset.
|
|
6
|
+
|
|
7
|
+
The OpenLint CLI retains the `spectral:oas` spelling for compatibility. To
|
|
8
|
+
extend the package directly, use:
|
|
9
|
+
|
|
10
|
+
```yaml
|
|
11
|
+
extends: "@openlint/ruleset-spectral-oas"
|
|
12
|
+
```
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oas = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const oas_1 = tslib_1.__importDefault(require("./oas"));
|
|
6
|
+
exports.oas = oas_1.default;
|
|
7
|
+
exports.default = oas_1.default;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AAAA,wDAAwB;AAEf,cAFF,aAAG,CAEE;AACZ,kBAAe,aAAG,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { default as oasOpParams } from './oasOpParams';
|
|
2
|
+
import { default as oasSchema } from './oasSchema';
|
|
3
|
+
import { default as oasDocumentSchema } from './oasDocumentSchema';
|
|
4
|
+
import { default as oasOpFormDataConsumeCheck } from './oasOpFormDataConsumeCheck';
|
|
5
|
+
import { default as oasOpSuccessResponse } from './oasOpSuccessResponse';
|
|
6
|
+
import { default as oasExample } from './oasExample';
|
|
7
|
+
import { default as oasSecurityDefined } from './oasSecurityDefined';
|
|
8
|
+
import { default as typedEnum } from './typedEnum';
|
|
9
|
+
import { default as refSiblings } from './refSiblings';
|
|
10
|
+
import { default as oasPathParam } from './oasPathParam';
|
|
11
|
+
import { default as oasTagDefined } from './oasTagDefined';
|
|
12
|
+
import { default as oasUnusedComponent } from './oasUnusedComponent';
|
|
13
|
+
import { default as oasOpIdUnique } from './oasOpIdUnique';
|
|
14
|
+
import { default as oasDiscriminator } from './oasDiscriminator';
|
|
15
|
+
export { oasOpParams, oasSchema, oasDocumentSchema, oasOpFormDataConsumeCheck, oasOpSuccessResponse, oasExample, oasSecurityDefined, typedEnum, refSiblings, oasPathParam, oasTagDefined, oasUnusedComponent, oasOpIdUnique, oasDiscriminator, };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.oasDiscriminator = exports.oasOpIdUnique = exports.oasUnusedComponent = exports.oasTagDefined = exports.oasPathParam = exports.refSiblings = exports.typedEnum = exports.oasSecurityDefined = exports.oasExample = exports.oasOpSuccessResponse = exports.oasOpFormDataConsumeCheck = exports.oasDocumentSchema = exports.oasSchema = exports.oasOpParams = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const oasOpParams_1 = tslib_1.__importDefault(require("./oasOpParams"));
|
|
6
|
+
Object.defineProperty(exports, "oasOpParams", { enumerable: true, get: function () { return oasOpParams_1.default; } });
|
|
7
|
+
const oasSchema_1 = tslib_1.__importDefault(require("./oasSchema"));
|
|
8
|
+
Object.defineProperty(exports, "oasSchema", { enumerable: true, get: function () { return oasSchema_1.default; } });
|
|
9
|
+
const oasDocumentSchema_1 = tslib_1.__importDefault(require("./oasDocumentSchema"));
|
|
10
|
+
Object.defineProperty(exports, "oasDocumentSchema", { enumerable: true, get: function () { return oasDocumentSchema_1.default; } });
|
|
11
|
+
const oasOpFormDataConsumeCheck_1 = tslib_1.__importDefault(require("./oasOpFormDataConsumeCheck"));
|
|
12
|
+
Object.defineProperty(exports, "oasOpFormDataConsumeCheck", { enumerable: true, get: function () { return oasOpFormDataConsumeCheck_1.default; } });
|
|
13
|
+
const oasOpSuccessResponse_1 = tslib_1.__importDefault(require("./oasOpSuccessResponse"));
|
|
14
|
+
Object.defineProperty(exports, "oasOpSuccessResponse", { enumerable: true, get: function () { return oasOpSuccessResponse_1.default; } });
|
|
15
|
+
const oasExample_1 = tslib_1.__importDefault(require("./oasExample"));
|
|
16
|
+
Object.defineProperty(exports, "oasExample", { enumerable: true, get: function () { return oasExample_1.default; } });
|
|
17
|
+
const oasSecurityDefined_1 = tslib_1.__importDefault(require("./oasSecurityDefined"));
|
|
18
|
+
Object.defineProperty(exports, "oasSecurityDefined", { enumerable: true, get: function () { return oasSecurityDefined_1.default; } });
|
|
19
|
+
const typedEnum_1 = tslib_1.__importDefault(require("./typedEnum"));
|
|
20
|
+
Object.defineProperty(exports, "typedEnum", { enumerable: true, get: function () { return typedEnum_1.default; } });
|
|
21
|
+
const refSiblings_1 = tslib_1.__importDefault(require("./refSiblings"));
|
|
22
|
+
Object.defineProperty(exports, "refSiblings", { enumerable: true, get: function () { return refSiblings_1.default; } });
|
|
23
|
+
const oasPathParam_1 = tslib_1.__importDefault(require("./oasPathParam"));
|
|
24
|
+
Object.defineProperty(exports, "oasPathParam", { enumerable: true, get: function () { return oasPathParam_1.default; } });
|
|
25
|
+
const oasTagDefined_1 = tslib_1.__importDefault(require("./oasTagDefined"));
|
|
26
|
+
Object.defineProperty(exports, "oasTagDefined", { enumerable: true, get: function () { return oasTagDefined_1.default; } });
|
|
27
|
+
const oasUnusedComponent_1 = tslib_1.__importDefault(require("./oasUnusedComponent"));
|
|
28
|
+
Object.defineProperty(exports, "oasUnusedComponent", { enumerable: true, get: function () { return oasUnusedComponent_1.default; } });
|
|
29
|
+
const oasOpIdUnique_1 = tslib_1.__importDefault(require("./oasOpIdUnique"));
|
|
30
|
+
Object.defineProperty(exports, "oasOpIdUnique", { enumerable: true, get: function () { return oasOpIdUnique_1.default; } });
|
|
31
|
+
const oasDiscriminator_1 = tslib_1.__importDefault(require("./oasDiscriminator"));
|
|
32
|
+
Object.defineProperty(exports, "oasDiscriminator", { enumerable: true, get: function () { return oasDiscriminator_1.default; } });
|
|
33
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/oas/functions/index.ts"],"names":[],"mappings":";;;;AAAA,wEAAuD;AAgBrD,4FAhBkB,qBAAW,OAgBlB;AAfb,oEAAmD;AAgBjD,0FAhBkB,mBAAS,OAgBlB;AAfX,oFAAmE;AAgBjE,kGAhBkB,2BAAiB,OAgBlB;AAfnB,oGAAmF;AAgBjF,0GAhBkB,mCAAyB,OAgBlB;AAf3B,0FAAyE;AAgBvE,qGAhBkB,8BAAoB,OAgBlB;AAftB,sEAAqD;AAgBnD,2FAhBkB,oBAAU,OAgBlB;AAfZ,sFAAqE;AAgBnE,mGAhBkB,4BAAkB,OAgBlB;AAfpB,oEAAmD;AAgBjD,0FAhBkB,mBAAS,OAgBlB;AAfX,wEAAuD;AAgBrD,4FAhBkB,qBAAW,OAgBlB;AAfb,0EAAyD;AAgBvD,6FAhBkB,sBAAY,OAgBlB;AAfd,4EAA2D;AAgBzD,8FAhBkB,uBAAa,OAgBlB;AAff,sFAAqE;AAgBnE,mGAhBkB,4BAAkB,OAgBlB;AAfpB,4EAA2D;AAgBzD,8FAhBkB,uBAAa,OAgBlB;AAff,kFAAiE;AAgB/D,iGAhBkB,0BAAgB,OAgBlB"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const openlint_core_1 = require("@openlint/openlint-core");
|
|
4
|
+
const isObject_1 = require("./utils/isObject");
|
|
5
|
+
exports.default = (0, openlint_core_1.createRulesetFunction)({
|
|
6
|
+
input: {
|
|
7
|
+
type: 'object',
|
|
8
|
+
properties: {
|
|
9
|
+
discriminator: {
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
required: ['discriminator'],
|
|
14
|
+
},
|
|
15
|
+
options: null,
|
|
16
|
+
}, function oasDiscriminator(schema, _opts, { path }) {
|
|
17
|
+
/**
|
|
18
|
+
* This function verifies:
|
|
19
|
+
*
|
|
20
|
+
* 1. The discriminator property name is defined at this schema.
|
|
21
|
+
* 2. The discriminator property is in the required property list.
|
|
22
|
+
*/
|
|
23
|
+
const discriminatorName = schema.discriminator;
|
|
24
|
+
const results = [];
|
|
25
|
+
if (!(0, isObject_1.isObject)(schema.properties) || !Object.keys(schema.properties).some(k => k === discriminatorName)) {
|
|
26
|
+
results.push({
|
|
27
|
+
message: `The discriminator property must be defined in this schema.`,
|
|
28
|
+
path: [...path, 'properties'],
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
if (!Array.isArray(schema.required) || !schema.required.some(n => n === discriminatorName)) {
|
|
32
|
+
results.push({
|
|
33
|
+
message: `The discriminator property must be in the required property list.`,
|
|
34
|
+
path: [...path, 'required'],
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return results;
|
|
38
|
+
});
|
|
39
|
+
//# sourceMappingURL=oasDiscriminator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oasDiscriminator.js","sourceRoot":"","sources":["../../../src/oas/functions/oasDiscriminator.ts"],"names":[],"mappings":";;AAAA,2DAAiF;AACjF,+CAA4C;AAO5C,kBAAe,IAAA,qCAAqB,EAClC;IACE,KAAK,EAAE;QACL,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE;YACV,aAAa,EAAE;gBACb,IAAI,EAAE,QAAQ;aACf;SACF;QACD,QAAQ,EAAE,CAAC,eAAe,CAAC;KAC5B;IACD,OAAO,EAAE,IAAI;CACd,EACD,SAAS,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE;IAC/C;;;;;OAKG;IAEH,MAAM,iBAAiB,GAAG,MAAM,CAAC,aAAa,CAAC;IAE/C,MAAM,OAAO,GAAsB,EAAE,CAAC;IAEtC,IAAI,CAAC,IAAA,mBAAQ,EAAC,MAAM,CAAC,UAAU,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,iBAAiB,CAAC,EAAE,CAAC;QACvG,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,EAAE,4DAA4D;YACrE,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,YAAY,CAAC;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,iBAAiB,CAAC,EAAE,CAAC;QAC3F,OAAO,CAAC,IAAI,CAAC;YACX,OAAO,EAAE,mEAAmE;YAC5E,IAAI,EAAE,CAAC,GAAG,IAAI,EAAE,UAAU,CAAC;SAC5B,CAAC,CAAC;IACL,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CACF,CAAC"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const openlint_core_1 = require("@openlint/openlint-core");
|
|
5
|
+
const openlint_formats_1 = require("@openlint/openlint-formats");
|
|
6
|
+
const json_1 = require("@stoplight/json");
|
|
7
|
+
const leven_1 = tslib_1.__importDefault(require("leven"));
|
|
8
|
+
const validators = tslib_1.__importStar(require("../schemas/validators"));
|
|
9
|
+
exports.default = (0, openlint_core_1.createRulesetFunction)({
|
|
10
|
+
input: null,
|
|
11
|
+
options: null,
|
|
12
|
+
}, function oasDocumentSchema(input, _opts, context) {
|
|
13
|
+
const formats = context.document.formats;
|
|
14
|
+
if (formats === null || formats === void 0)
|
|
15
|
+
return;
|
|
16
|
+
const schema = formats.has(openlint_formats_1.oas2)
|
|
17
|
+
? 'oas2_0'
|
|
18
|
+
: formats.has(openlint_formats_1.oas3_2)
|
|
19
|
+
? 'oas3_2'
|
|
20
|
+
: formats.has(openlint_formats_1.oas3_1)
|
|
21
|
+
? 'oas3_1'
|
|
22
|
+
: 'oas3_0';
|
|
23
|
+
const validator = validators[schema];
|
|
24
|
+
validator(input);
|
|
25
|
+
const errors = validator.errors;
|
|
26
|
+
return errors === null || errors === void 0 ? void 0 : errors.reduce((errors, e) => processError(errors, input, schema, e), []);
|
|
27
|
+
});
|
|
28
|
+
function isRelevantError(error) {
|
|
29
|
+
return error.keyword !== 'if';
|
|
30
|
+
}
|
|
31
|
+
function processError(errors, input, schema, error) {
|
|
32
|
+
if (!isRelevantError(error)) {
|
|
33
|
+
return errors;
|
|
34
|
+
}
|
|
35
|
+
const path = error.instancePath === '' ? [] : error.instancePath.slice(1).split('/');
|
|
36
|
+
const property = path.length === 0 ? null : path[path.length - 1];
|
|
37
|
+
let message;
|
|
38
|
+
switch (error.keyword) {
|
|
39
|
+
case 'additionalProperties': {
|
|
40
|
+
const additionalProperty = error.params['additionalProperty'];
|
|
41
|
+
path.push(additionalProperty);
|
|
42
|
+
message = `Property "${additionalProperty}" is not expected to be here`;
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case 'enum': {
|
|
46
|
+
const allowedValues = error.params['allowedValues'];
|
|
47
|
+
const printedValues = allowedValues.map(value => JSON.stringify(value)).join(', ');
|
|
48
|
+
let suggestion;
|
|
49
|
+
if (!(0, json_1.isPlainObject)(input)) {
|
|
50
|
+
suggestion = '';
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
const value = (0, json_1.resolveInlineRef)(input, `#${error.instancePath}`);
|
|
54
|
+
if (typeof value !== 'string') {
|
|
55
|
+
suggestion = '';
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
const bestMatch = findBestMatch(value, allowedValues);
|
|
59
|
+
if (bestMatch !== null) {
|
|
60
|
+
suggestion = `. Did you mean "${bestMatch}"?`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
suggestion = '';
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
message = `${cleanAjvMessage(property, error.message)}: ${printedValues}${suggestion}`;
|
|
68
|
+
break;
|
|
69
|
+
}
|
|
70
|
+
case 'errorMessage':
|
|
71
|
+
message = String(error.message);
|
|
72
|
+
break;
|
|
73
|
+
default:
|
|
74
|
+
message = cleanAjvMessage(property, error.message);
|
|
75
|
+
}
|
|
76
|
+
errors.push({
|
|
77
|
+
message,
|
|
78
|
+
path,
|
|
79
|
+
});
|
|
80
|
+
return errors;
|
|
81
|
+
}
|
|
82
|
+
function findBestMatch(value, allowedValues) {
|
|
83
|
+
const matches = allowedValues
|
|
84
|
+
.filter((value) => typeof value === 'string')
|
|
85
|
+
.map(allowedValue => ({
|
|
86
|
+
value: allowedValue,
|
|
87
|
+
weight: (0, leven_1.default)(value, allowedValue),
|
|
88
|
+
}))
|
|
89
|
+
.sort((x, y) => (x.weight > y.weight ? 1 : x.weight < y.weight ? -1 : 0));
|
|
90
|
+
if (matches.length === 0) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
const bestMatch = matches[0];
|
|
94
|
+
return allowedValues.length === 1 || bestMatch.weight < bestMatch.value.length ? bestMatch.value : null;
|
|
95
|
+
}
|
|
96
|
+
const QUOTES = /['"]/g;
|
|
97
|
+
const NOT = /NOT/g;
|
|
98
|
+
function cleanAjvMessage(prop, message) {
|
|
99
|
+
if (typeof message !== 'string')
|
|
100
|
+
return '';
|
|
101
|
+
const cleanedMessage = message.replace(QUOTES, '"').replace(NOT, 'not');
|
|
102
|
+
return prop === null ? cleanedMessage : `"${prop}" property ${cleanedMessage}`;
|
|
103
|
+
}
|
|
104
|
+
//# sourceMappingURL=oasDocumentSchema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oasDocumentSchema.js","sourceRoot":"","sources":["../../../src/oas/functions/oasDocumentSchema.ts"],"names":[],"mappings":";;;AAAA,2DAAgE;AAEhE,iEAAkE;AAClE,0CAAkE;A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