Skip to content

Commit b2f37f2

Browse files
committed
docs(ns-openapi-3-0): adapt to having OpenAPI 3.0.4 support
Refs #4612
1 parent db2140e commit b2f37f2

File tree

6 files changed

+66
-65
lines changed

6 files changed

+66
-65
lines changed

packages/apidom-ns-openapi-3-0/README.md

+32-31
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
`@swagger-api/apidom-ns-openapi-3-0` contains ApiDOM namespace supports following OpenAPI specification versions:
44

5+
- [OpenAPI 3.0.4 specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md)
56
- [OpenAPI 3.0.3 specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md)
67
- [OpenAPI 3.0.2 specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.2.md)
78
- [OpenAPI 3.0.1 specification](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.1.md)
@@ -156,7 +157,7 @@ import { parse } from '@swagger-api/apidom-parser-adapter-yaml-1-2';
156157
import { refractorPluginReplaceEmptyElement, OpenApi3_0Element } from '@swagger-api/apidom-ns-openapi-3-0';
157158

158159
const yamlDefinition = `
159-
openapi: 3.0.3
160+
openapi: 3.0.4
160161
info:
161162
`;
162163
const apiDOM = await parse(yamlDefinition);
@@ -187,34 +188,34 @@ const openApiElement = OpenApi3_0Element.refract(apiDOM.result, {
187188

188189
Only fully implemented specification objects should be checked here.
189190

190-
- [x] [OpenAPI Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oasObject)
191-
- [x] [Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#infoObject)
192-
- [x] [Contact Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#contactObject)
193-
- [x] [License Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#licenseObject)
194-
- [x] [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverObject)
195-
- [x] [Server Variable Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#serverVariableObject)
196-
- [x] [Components](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#componentsObject)
197-
- [x] [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathsObject)
198-
- [x] [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#pathItemObject)
199-
- [x] [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#operationObject)
200-
- [x] [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#externalDocumentationObject)
201-
- [x] [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#parameterObject)
202-
- [x] [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#requestBodyObject)
203-
- [x] [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#mediaTypeObject)
204-
- [x] [Encoding Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#encodingObject)
205-
- [x] [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#responsesObject)
206-
- [x] [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#callbackObject)
207-
- [x] [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#exampleObject)
208-
- [x] [Link Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#linkObject)
209-
- [x] [Header Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#headerObject)
210-
- [x] [Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#tagObject)
211-
- [x] [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#referenceObject)
212-
- [x] [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#schemaObject)
213-
- [x] [Discriminator Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#discriminatorObject)
214-
- [x] [XML Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#xmlObject)
215-
- [x] [Security Scheme Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securitySchemeObject)
216-
- [x] [OAuth Flows Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowsObject)
217-
- [x] [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#oauthFlowObject)
218-
- [x] [Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#securityRequirementObject)
219-
- [x] [Specification extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.3.md#specificationExtensions)
191+
- [x] [OpenAPI Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#openapi-object)
192+
- [x] [Info Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#info-object)
193+
- [x] [Contact Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#contact-object)
194+
- [x] [License Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#license-object)
195+
- [x] [Server Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-object)
196+
- [x] [Server Variable Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#server-variable-object)
197+
- [x] [Components](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#components-object)
198+
- [x] [Paths Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#paths-object)
199+
- [x] [Path Item Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#path-item-object)
200+
- [x] [Operation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#operation-object)
201+
- [x] [External Documentation Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#external-documentation-object)
202+
- [x] [Parameter Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#parameter-object)
203+
- [x] [Request Body Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#request-body-object)
204+
- [x] [Media Type Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#media-type-object)
205+
- [x] [Encoding Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#encoding-object)
206+
- [x] [Responses Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#responses-object)
207+
- [x] [Callback Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#callback-object)
208+
- [x] [Example Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#example-object)
209+
- [x] [Link Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#link-object)
210+
- [x] [Header Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#header-object)
211+
- [x] [Tag Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#tag-object)
212+
- [x] [Reference Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#reference-object)
213+
- [x] [Schema Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#schema-object)
214+
- [x] [Discriminator Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#discriminator-object)
215+
- [x] [XML Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#xml-object)
216+
- [x] [Security Scheme Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#security-scheme-object)
217+
- [x] [OAuth Flows Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#oauth-flows-pbject)
218+
- [x] [OAuth Flow Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#oauth-flow-object)
219+
- [x] [Security Requirement Object](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#security-requirement-object)
220+
- [x] [Specification extensions](https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.0.4.md#specification-extensions)
220221

packages/apidom-ns-openapi-3-0/test/refractor/__snapshots__/index.mjs.snap

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`refractor given generic ApiDOM object in OpenApi 3.0.3 shape should refract to OpenApi 3.0 Element 1`] = `
3+
exports[`refractor given generic ApiDOM object in OpenApi 3.0.4 shape should refract to OpenApi 3.0 Element 1`] = `
44
{
55
"element": "openApi3_0",
66
"meta": {
@@ -50,7 +50,7 @@ exports[`refractor given generic ApiDOM object in OpenApi 3.0.3 shape should ref
5050
]
5151
}
5252
},
53-
"content": "3.0.3"
53+
"content": "3.0.4"
5454
}
5555
}
5656
},

packages/apidom-ns-openapi-3-0/test/refractor/fixtures/openapi.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"openapi": "3.0.3",
2+
"openapi": "3.0.4",
33
"info": {
44
"title": "Sample Pet Store App",
55
"description": "This is a sample server for a pet store.",

packages/apidom-ns-openapi-3-0/test/refractor/index.ts

+20-20
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import * as predicates from '../../src/predicates.ts';
2020
const __dirname = path.dirname(fileURLToPath(import.meta.url));
2121

2222
describe('refractor', function () {
23-
context('given generic ApiDOM object in OpenApi 3.0.3 shape', function () {
23+
context('given generic ApiDOM object in OpenApi 3.0.4 shape', function () {
2424
specify('should refract to OpenApi 3.0 Element', function () {
2525
const openApiString = fs
2626
.readFileSync(path.join(__dirname, 'fixtures', 'openapi.json'))
@@ -57,7 +57,7 @@ describe('refractor', function () {
5757
visitor: {
5858
OpenapiElement(element: OpenapiElement) {
5959
// @ts-ignore
60-
element.content = '3.0.4'; // eslint-disable-line no-param-reassign
60+
element.content = '3.0.5'; // eslint-disable-line no-param-reassign
6161
},
6262
},
6363
post() {},
@@ -88,7 +88,7 @@ describe('refractor', function () {
8888
context('plugin', function () {
8989
specify('should be called with toolbox object', function () {
9090
const genericObject = new ObjectElement({
91-
openapi: '3.0.3',
91+
openapi: '3.0.4',
9292
});
9393
OpenApi3_0Element.refract(genericObject, {
9494
plugins: [plugin1],
@@ -99,7 +99,7 @@ describe('refractor', function () {
9999

100100
specify('should have predicates in toolbox object', function () {
101101
const genericObject = new ObjectElement({
102-
openapi: '3.0.3',
102+
openapi: '3.0.4',
103103
});
104104
OpenApi3_0Element.refract(genericObject, {
105105
plugins: [plugin1],
@@ -110,7 +110,7 @@ describe('refractor', function () {
110110

111111
specify('should have namespace in toolbox object', function () {
112112
const genericObject = new ObjectElement({
113-
openapi: '3.0.3',
113+
openapi: '3.0.4',
114114
});
115115
OpenApi3_0Element.refract(genericObject, {
116116
plugins: [plugin1],
@@ -123,7 +123,7 @@ describe('refractor', function () {
123123
context('pre hook', function () {
124124
specify('should call it once', function () {
125125
const genericObject = new ObjectElement({
126-
openapi: '3.0.3',
126+
openapi: '3.0.4',
127127
});
128128
OpenApi3_0Element.refract(genericObject, {
129129
plugins: [plugin1],
@@ -134,7 +134,7 @@ describe('refractor', function () {
134134

135135
specify('should call it before other plugin pre hook', function () {
136136
const genericObject = new ObjectElement({
137-
openapi: '3.0.3',
137+
openapi: '3.0.4',
138138
});
139139
OpenApi3_0Element.refract(genericObject, {
140140
plugins: [plugin1, plugin2],
@@ -145,7 +145,7 @@ describe('refractor', function () {
145145

146146
specify('should call it before visiting', function () {
147147
const genericObject = new ObjectElement({
148-
openapi: '3.0.3',
148+
openapi: '3.0.4',
149149
});
150150
OpenApi3_0Element.refract(genericObject, {
151151
plugins: [plugin1, plugin2],
@@ -159,7 +159,7 @@ describe('refractor', function () {
159159
context('post hook', function () {
160160
specify('should call it once', function () {
161161
const genericObject = new ObjectElement({
162-
openapi: '3.0.3',
162+
openapi: '3.0.4',
163163
});
164164
OpenApi3_0Element.refract(genericObject, {
165165
plugins: [plugin1],
@@ -170,7 +170,7 @@ describe('refractor', function () {
170170

171171
specify('should call it before other plugin post hook', function () {
172172
const genericObject = new ObjectElement({
173-
openapi: '3.0.3',
173+
openapi: '3.0.4',
174174
});
175175
OpenApi3_0Element.refract(genericObject, {
176176
plugins: [plugin1, plugin2],
@@ -181,7 +181,7 @@ describe('refractor', function () {
181181

182182
specify('should call it after visiting', function () {
183183
const genericObject = new ObjectElement({
184-
openapi: '3.0.3',
184+
openapi: '3.0.4',
185185
});
186186
OpenApi3_0Element.refract(genericObject, {
187187
plugins: [plugin1, plugin2],
@@ -195,7 +195,7 @@ describe('refractor', function () {
195195
context('visitor', function () {
196196
specify('should be called once', function () {
197197
const genericObject = new ObjectElement({
198-
openapi: '3.0.3',
198+
openapi: '3.0.4',
199199
});
200200
OpenApi3_0Element.refract(genericObject, {
201201
plugins: [plugin1, plugin2],
@@ -207,7 +207,7 @@ describe('refractor', function () {
207207

208208
specify('should be called in proper order', function () {
209209
const genericObject = new ObjectElement({
210-
openapi: '3.0.3',
210+
openapi: '3.0.4',
211211
});
212212
OpenApi3_0Element.refract(genericObject, {
213213
plugins: [plugin1, plugin2],
@@ -221,7 +221,7 @@ describe('refractor', function () {
221221
context('first plugin', function () {
222222
specify('should receive arguments', function () {
223223
const genericObject = new ObjectElement({
224-
openapi: '3.0.3',
224+
openapi: '3.0.4',
225225
});
226226
OpenApi3_0Element.refract(genericObject, {
227227
plugins: [plugin1],
@@ -232,7 +232,7 @@ describe('refractor', function () {
232232

233233
specify('should receive node as first argument', function () {
234234
const genericObject = new ObjectElement({
235-
openapi: '3.0.3',
235+
openapi: '3.0.4',
236236
});
237237
OpenApi3_0Element.refract(genericObject, {
238238
plugins: [plugin1],
@@ -243,20 +243,20 @@ describe('refractor', function () {
243243

244244
specify('should augment openapi version', function () {
245245
const genericObject = new ObjectElement({
246-
openapi: '3.0.3',
246+
openapi: '3.0.4',
247247
});
248248
const openApiElement = OpenApi3_0Element.refract(genericObject, {
249249
plugins: [plugin1],
250250
});
251251

252-
assert.deepEqual(toValue(openApiElement), { openapi: '3.0.4' });
252+
assert.deepEqual(toValue(openApiElement), { openapi: '3.0.5' });
253253
});
254254
});
255255

256256
context('second plugin', function () {
257257
specify('should receive arguments', function () {
258258
const genericObject = new ObjectElement({
259-
openapi: '3.0.3',
259+
openapi: '3.0.4',
260260
});
261261
OpenApi3_0Element.refract(genericObject, {
262262
plugins: [plugin1, plugin2],
@@ -267,7 +267,7 @@ describe('refractor', function () {
267267

268268
specify('should receive node as first argument', function () {
269269
const genericObject = new ObjectElement({
270-
openapi: '3.0.3',
270+
openapi: '3.0.4',
271271
});
272272
OpenApi3_0Element.refract(genericObject, {
273273
plugins: [plugin1, plugin2],
@@ -278,7 +278,7 @@ describe('refractor', function () {
278278

279279
specify('should append metadata to openapi version', function () {
280280
const genericObject = new ObjectElement({
281-
openapi: '3.0.3',
281+
openapi: '3.0.4',
282282
});
283283
const openApiElement = OpenApi3_0Element.refract(genericObject, {
284284
plugins: [plugin1, plugin2],

packages/apidom-ns-openapi-3-0/test/refractor/plugins/replace-empty-element/mappings.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { refractorPluginReplaceEmptyElement, OpenApi3_0Element } from '../../../
88
describe('given empty value instead of InfoElement', function () {
99
it('should replace empty value with semantic element', async function () {
1010
const yamlDefinition = dedent`
11-
openapi: 3.0.3
11+
openapi: 3.0.4
1212
info:
1313
`;
1414
const apiDOM = await parse(yamlDefinition);
@@ -23,7 +23,7 @@ describe('given empty value instead of InfoElement', function () {
2323
describe('given empty value instead of ContactElement', function () {
2424
it('should replace empty value with semantic element', async function () {
2525
const yamlDefinition = dedent`
26-
openapi: 3.0.3
26+
openapi: 3.0.4
2727
info:
2828
contact:
2929
`;
@@ -39,7 +39,7 @@ describe('given empty value instead of ContactElement', function () {
3939
describe('given empty value instead for OpenAPI.components.schemas', function () {
4040
it('should replace empty value with semantic element', async function () {
4141
const yamlDefinition = dedent`
42-
openapi: 3.0.3
42+
openapi: 3.0.4
4343
components:
4444
schemas:
4545
`;
@@ -60,7 +60,7 @@ describe('given empty value instead for OpenAPI.components.schemas', function ()
6060
describe('given empty value instead for OpenAPI.components.schemas.*', function () {
6161
it('should replace empty value with semantic element', async function () {
6262
const yamlDefinition = dedent`
63-
openapi: 3.0.3
63+
openapi: 3.0.4
6464
components:
6565
schemas:
6666
Schema1:
@@ -77,7 +77,7 @@ describe('given empty value instead for OpenAPI.components.schemas.*', function
7777
describe('given empty value instead for Schema.properties.*', function () {
7878
it('should replace empty value with semantic element', async function () {
7979
const yamlDefinition = dedent`
80-
openapi: 3.0.3
80+
openapi: 3.0.4
8181
components:
8282
schemas:
8383
User:
@@ -96,7 +96,7 @@ describe('given empty value instead for Schema.properties.*', function () {
9696
describe('given OpenAPI definition with no empty values', function () {
9797
it('should do nothing', async function () {
9898
const yamlDefinition = dedent`
99-
openapi: 3.0.3
99+
openapi: 3.0.4
100100
info: {}
101101
`;
102102
const apiDOM = await parse(yamlDefinition);
@@ -111,7 +111,7 @@ describe('given OpenAPI definition with no empty values', function () {
111111
describe('given OpenAPI definition with empty values', function () {
112112
it('should generate proper source maps', async function () {
113113
const yamlDefinition = dedent`
114-
openapi: 3.0.3
114+
openapi: 3.0.4
115115
info:
116116
`;
117117
const apiDOM = await parse(yamlDefinition, { sourceMap: true });

packages/apidom-ns-openapi-3-0/test/refractor/plugins/replace-empty-element/sequences.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import { refractorPluginReplaceEmptyElement, OpenApi3_0Element } from '../../../
88
describe('given empty value instead of ServerElement', function () {
99
it('should replace empty value with semantic element', async function () {
1010
const yamlDefinition = dedent`
11-
openapi: 3.0.3
11+
openapi: 3.0.4
1212
servers:
1313
-
1414
`;
@@ -24,7 +24,7 @@ describe('given empty value instead of ServerElement', function () {
2424
describe('given empty value instead of SecurityRequirementElement', function () {
2525
it('should replace empty value with semantic element', async function () {
2626
const yamlDefinition = dedent`
27-
openapi: 3.0.3
27+
openapi: 3.0.4
2828
security:
2929
-
3030
`;
@@ -40,7 +40,7 @@ describe('given empty value instead of SecurityRequirementElement', function ()
4040
describe('given multiple empty values instead of TagElement', function () {
4141
it('should replace empty values with semantic elements', async function () {
4242
const yamlDefinition = dedent`
43-
openapi: 3.0.3
43+
openapi: 3.0.4
4444
tags:
4545
-
4646
-
@@ -57,7 +57,7 @@ describe('given multiple empty values instead of TagElement', function () {
5757
describe('given empty values instead of SchemaElement for allOf keyword', function () {
5858
it('should replace empty values with semantic elements', async function () {
5959
const yamlDefinition = dedent`
60-
openapi: 3.0.3
60+
openapi: 3.0.4
6161
components:
6262
schemas:
6363
Schema1:

0 commit comments

Comments
 (0)