Skip to content

Commit 0e8336c

Browse files
aaqilnizdhmlau
authored andcommitted
fix: iterate through content object properties
Signed-off-by: Muhammad Aaqil <[email protected]>
1 parent f256355 commit 0e8336c

File tree

3 files changed

+50
-4
lines changed

3 files changed

+50
-4
lines changed

packages/cli/generators/openapi/spec-helper.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -396,8 +396,8 @@ function buildMethodSpec(controllerSpec, op, options) {
396396
const json = content && content['application/json'];
397397
propSchema = json && json.schema;
398398
if (propSchema == null && content) {
399-
for (const m of content) {
400-
propSchema = content[m].schema;
399+
for (const contentProperty in content) {
400+
propSchema = contentProperty.schema;
401401
if (propSchema) break;
402402
}
403403
}

packages/cli/snapshots/integration/generators/openapi-uspto.integration.snapshots.js

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,7 @@ the syntax options shown below.
330330
* @param dataset Name of the dataset. In this case, the default value is
331331
oa_citations
332332
* @param version Version of the dataset.
333+
* @param page Page you would like to fetch.
333334
* @returns The dataset api for the given version is found and it is accessible
334335
to consume.
335336
*/
@@ -361,6 +362,16 @@ to consume.
361362
default: 'v1',
362363
},
363364
},
365+
{
366+
name: 'page',
367+
in: 'query',
368+
description: 'Page you would like to fetch.',
369+
content: {
370+
'*/*': {
371+
type: 'string',
372+
},
373+
},
374+
},
364375
],
365376
responses: {
366377
'200': {
@@ -403,7 +414,16 @@ to consume.
403414
type: 'string',
404415
default: 'v1',
405416
},
406-
}) version: string): Promise<string> {
417+
}) version: string, @param({
418+
name: 'page',
419+
in: 'query',
420+
description: 'Page you would like to fetch.',
421+
content: {
422+
'*/*': {
423+
type: 'string',
424+
},
425+
},
426+
}) page: string | undefined): Promise<string> {
407427
throw new Error('Not implemented');
408428
}
409429
}
@@ -530,6 +550,7 @@ the syntax options shown below.
530550
* @param dataset Name of the dataset. In this case, the default value is
531551
oa_citations
532552
* @param version Version of the dataset.
553+
* @param page Page you would like to fetch.
533554
* @returns The dataset api for the given version is found and it is accessible
534555
to consume.
535556
*/
@@ -561,6 +582,16 @@ to consume.
561582
default: 'v1',
562583
},
563584
},
585+
{
586+
name: 'page',
587+
in: 'query',
588+
description: 'Page you would like to fetch.',
589+
content: {
590+
'*/*': {
591+
type: 'string',
592+
},
593+
},
594+
},
564595
],
565596
responses: {
566597
'200': {
@@ -603,7 +634,16 @@ to consume.
603634
type: 'string',
604635
default: 'v1',
605636
},
606-
}) version: string): Promise<string> {
637+
}) version: string, @param({
638+
name: 'page',
639+
in: 'query',
640+
description: 'Page you would like to fetch.',
641+
content: {
642+
'*/*': {
643+
type: 'string',
644+
},
645+
},
646+
}) page: string | undefined): Promise<string> {
607647
throw new Error('Not implemented');
608648
}
609649
}

packages/cli/test/fixtures/openapi/3.0/uspto.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,12 @@ paths:
9090
schema:
9191
type: string
9292
default: v1
93+
- name: page
94+
in: query
95+
description: Page you would like to fetch.
96+
content:
97+
'*/*':
98+
type: string
9399
responses:
94100
'200':
95101
description: >-

0 commit comments

Comments
 (0)