Skip to content

Commit 8e4edb5

Browse files
committed
Refactor OpenAPI schema references to use unified OASInput; remove deprecated input schemas in ToolsService
1 parent 74da3f3 commit 8e4edb5

3 files changed

Lines changed: 21 additions & 72 deletions

File tree

api/openapi.yaml

Lines changed: 7 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ paths:
9494
content:
9595
application/json:
9696
schema:
97-
$ref: "#/components/schemas/CreateBrunoCollectionInput"
97+
$ref: "#/components/schemas/OASInput"
9898
responses:
9999
"200":
100100
description: OK
@@ -124,7 +124,7 @@ paths:
124124
content:
125125
application/json:
126126
schema:
127-
$ref: "#/components/schemas/ConvertOASInput"
127+
$ref: "#/components/schemas/OASInput"
128128
responses:
129129
"200":
130130
description: OK
@@ -154,7 +154,7 @@ paths:
154154
content:
155155
application/json:
156156
schema:
157-
$ref: "#/components/schemas/DereferenceOASInput"
157+
$ref: "#/components/schemas/OASInput"
158158
responses:
159159
"200":
160160
description: OK
@@ -184,7 +184,7 @@ paths:
184184
content:
185185
application/json:
186186
schema:
187-
$ref: "#/components/schemas/GenerateOASInput"
187+
$ref: "#/components/schemas/OASInput"
188188
responses:
189189
"200":
190190
description: OK
@@ -214,7 +214,7 @@ paths:
214214
content:
215215
application/json:
216216
schema:
217-
$ref: "#/components/schemas/ValidatorOpenAPIPostInput"
217+
$ref: "#/components/schemas/OASInput"
218218
responses:
219219
"200":
220220
content:
@@ -248,7 +248,7 @@ paths:
248248
content:
249249
application/json:
250250
schema:
251-
$ref: "#/components/schemas/CreatePostmanCollectionInput"
251+
$ref: "#/components/schemas/OASInput"
252252
responses:
253253
"200":
254254
description: OK
@@ -295,47 +295,7 @@ components:
295295
arazzoUrl:
296296
type: string
297297
type: object
298-
ConvertOASInput:
299-
example:
300-
oasUrl: oasUrl
301-
oasBody: oasBody
302-
properties:
303-
oasBody:
304-
type: string
305-
oasUrl:
306-
type: string
307-
type: object
308-
CreateBrunoCollectionInput:
309-
example:
310-
oasUrl: oasUrl
311-
oasBody: oasBody
312-
properties:
313-
oasBody:
314-
type: string
315-
oasUrl:
316-
type: string
317-
type: object
318-
CreatePostmanCollectionInput:
319-
example:
320-
oasUrl: oasUrl
321-
oasBody: oasBody
322-
properties:
323-
oasBody:
324-
type: string
325-
oasUrl:
326-
type: string
327-
type: object
328-
DereferenceOASInput:
329-
example:
330-
oasUrl: oasUrl
331-
oasBody: oasBody
332-
properties:
333-
oasBody:
334-
type: string
335-
oasUrl:
336-
type: string
337-
type: object
338-
GenerateOASInput:
298+
OASInput:
339299
example:
340300
oasUrl: oasUrl
341301
oasBody: oasBody
@@ -471,16 +431,6 @@ components:
471431
email:
472432
type: string
473433
type: object
474-
ValidatorOpenAPIPostInput:
475-
example:
476-
oasUrl: oasUrl
477-
oasBody: oasBody
478-
properties:
479-
oasBody:
480-
type: string
481-
oasUrl:
482-
type: string
483-
type: object
484434
securitySchemes:
485435
apiKey:
486436
in: header

expressServer.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// const { Middleware } = require('swagger-express-middleware');
21
const http = require('node:http');
32
const fs = require('node:fs');
43
const path = require('node:path');
@@ -72,7 +71,7 @@ class ExpressServer {
7271
const pathItem = schema.paths[pathKey];
7372
for (const method of methods) {
7473
const operation = pathItem[method];
75-
if (operation?.operationId) {
74+
if (operation && operation.operationId) {
7675
const normalizedId = ExpressServer.sanitizeOperationId(operation.operationId);
7776
if (normalizedId && normalizedId !== operation.operationId) {
7877
operation['x-original-operationId'] = operation.operationId;
@@ -88,7 +87,7 @@ class ExpressServer {
8887
this.app = express();
8988
try {
9089
this.schema = jsYaml.safeLoad(fs.readFileSync(openApiYaml));
91-
if (this.schema?.components) {
90+
if (this.schema && this.schema?.components) {
9291
const { components } = this.schema;
9392
const componentMirrors = [
9493
'schemas',

services/ToolsService.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,10 @@ const arazzo = async (params) => {
3131
* Converteer OpenAPI 3.0/3.1
3232
* Zet OpenAPI 3.0 om naar 3.1 of andersom. Body: { oasUrl } of { oasBody } (stringified JSON of YAML).
3333
*
34-
* convertOASInput ConvertOASInput (optional)
34+
* oASInput OASInput (optional)
3535
* no response value expected for this operation
3636
*/
37-
// const convertOAS = async ({ convertOASInput }) => {
37+
// const convertOAS = async ({ oASInput }) => {
3838
const convertOAS = async (params) => {
3939
try {
4040
const mockResult = await Service.applyMock('ToolsService', 'convertOAS', params);
@@ -57,10 +57,10 @@ const convertOAS = async (params) => {
5757
* Maak Bruno-collectie (POST)
5858
* Converteert OpenAPI naar Bruno ZIP. Body: { oasUrl } of { oasBody } (stringified JSON of YAML).
5959
*
60-
* createBrunoCollectionInput CreateBrunoCollectionInput (optional)
60+
* oASInput OASInput (optional)
6161
* no response value expected for this operation
6262
*/
63-
// const createBrunoCollection = async ({ createBrunoCollectionInput }) => {
63+
// const createBrunoCollection = async ({ oASInput }) => {
6464
const createBrunoCollection = async (params) => {
6565
try {
6666
const mockResult = await Service.applyMock('ToolsService', 'createBrunoCollection', params);
@@ -83,10 +83,10 @@ const createBrunoCollection = async (params) => {
8383
* Maak Postman-collectie (POST)
8484
* Converteert OpenAPI naar Postman Collection JSON. Body: { oasUrl } of { oasBody } (stringified JSON of YAML).
8585
*
86-
* createPostmanCollectionInput CreatePostmanCollectionInput (optional)
86+
* oASInput OASInput (optional)
8787
* no response value expected for this operation
8888
*/
89-
// const createPostmanCollection = async ({ createPostmanCollectionInput }) => {
89+
// const createPostmanCollection = async ({ oASInput }) => {
9090
const createPostmanCollection = async (params) => {
9191
try {
9292
const mockResult = await Service.applyMock('ToolsService', 'createPostmanCollection', params);
@@ -109,10 +109,10 @@ const createPostmanCollection = async (params) => {
109109
* Dereference OpenAPI
110110
* Haalt externe $ref verwijzingen op en levert één compleet OpenAPI document terug. Body: { oasUrl } of { oasBody }.
111111
*
112-
* dereferenceOASInput DereferenceOASInput (optional)
112+
* oASInput OASInput (optional)
113113
* no response value expected for this operation
114114
*/
115-
// const dereferenceOAS = async ({ dereferenceOASInput }) => {
115+
// const dereferenceOAS = async ({ oASInput }) => {
116116
const dereferenceOAS = async (params) => {
117117
try {
118118
const mockResult = await Service.applyMock('ToolsService', 'dereferenceOAS', params);
@@ -135,10 +135,10 @@ const dereferenceOAS = async (params) => {
135135
* Generate OpenAPI
136136
* Zet OpenAPI 3.0 om naar 3.1 of andersom. Body: { oasUrl } of { oasBody } (stringified JSON of YAML).
137137
*
138-
* generateOASInput GenerateOASInput (optional)
138+
* oASInput OASInput (optional)
139139
* no response value expected for this operation
140140
*/
141-
// const generateOAS = async ({ generateOASInput }) => {
141+
// const generateOAS = async ({ oASInput }) => {
142142
const generateOAS = async (params) => {
143143
try {
144144
const mockResult = await Service.applyMock('ToolsService', 'generateOAS', params);
@@ -187,10 +187,10 @@ const untrustClient = async (params) => {
187187
* Validate OpenAPI (POST)
188188
* Valideert een OpenAPI specificatie met de DON ADR ruleset. Body: { oasUrl } of { oasBody } (stringified JSON of YAML).
189189
*
190-
* validatorOpenAPIPostInput ValidatorOpenAPIPostInput (optional)
190+
* oASInput OASInput (optional)
191191
* returns ModelsLintResult
192192
*/
193-
// const validatorOpenAPIPost = async ({ validatorOpenAPIPostInput }) => {
193+
// const validatorOpenAPIPost = async ({ oASInput }) => {
194194
const validatorOpenAPIPost = async (params) => {
195195
try {
196196
const mockResult = await Service.applyMock('ToolsService', 'validatorOpenAPIPost', params);

0 commit comments

Comments
 (0)