Skip to content

Commit

Permalink
fix: iterate through content object properties
Browse files Browse the repository at this point in the history
Signed-off-by: Muhammad Aaqil <[email protected]>
  • Loading branch information
aaqilniz committed Jul 25, 2024
1 parent 581bf5a commit ce3645c
Show file tree
Hide file tree
Showing 3 changed files with 50 additions and 4 deletions.
4 changes: 2 additions & 2 deletions packages/cli/generators/openapi/spec-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -396,8 +396,8 @@ function buildMethodSpec(controllerSpec, op, options) {
const json = content && content['application/json'];
propSchema = json && json.schema;
if (propSchema == null && content) {
for (const m of content) {
propSchema = content[m].schema;
for (const eachContent in content) {
propSchema = eachContent.schema;
if (propSchema) break;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ the syntax options shown below.
* @param dataset Name of the dataset. In this case, the default value is
oa_citations
* @param version Version of the dataset.
* @param page Page you would like to fetch.
* @returns The dataset api for the given version is found and it is accessible
to consume.
*/
Expand Down Expand Up @@ -361,6 +362,16 @@ to consume.
default: 'v1',
},
},
{
name: 'page',
in: 'query',
description: 'Page you would like to fetch.',
content: {
'*/*': {
type: 'string',
},
},
},
],
responses: {
'200': {
Expand Down Expand Up @@ -403,7 +414,16 @@ to consume.
type: 'string',
default: 'v1',
},
}) version: string): Promise<string> {
}) version: string, @param({
name: 'page',
in: 'query',
description: 'Page you would like to fetch.',
content: {
'*/*': {
type: 'string',
},
},
}) page: string | undefined): Promise<string> {
throw new Error('Not implemented');
}
}
Expand Down Expand Up @@ -530,6 +550,7 @@ the syntax options shown below.
* @param dataset Name of the dataset. In this case, the default value is
oa_citations
* @param version Version of the dataset.
* @param page Page you would like to fetch.
* @returns The dataset api for the given version is found and it is accessible
to consume.
*/
Expand Down Expand Up @@ -561,6 +582,16 @@ to consume.
default: 'v1',
},
},
{
name: 'page',
in: 'query',
description: 'Page you would like to fetch.',
content: {
'*/*': {
type: 'string',
},
},
},
],
responses: {
'200': {
Expand Down Expand Up @@ -603,7 +634,16 @@ to consume.
type: 'string',
default: 'v1',
},
}) version: string): Promise<string> {
}) version: string, @param({
name: 'page',
in: 'query',
description: 'Page you would like to fetch.',
content: {
'*/*': {
type: 'string',
},
},
}) page: string | undefined): Promise<string> {
throw new Error('Not implemented');
}
}
Expand Down
6 changes: 6 additions & 0 deletions packages/cli/test/fixtures/openapi/3.0/uspto.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ paths:
schema:
type: string
default: v1
- name: page
in: query
description: Page you would like to fetch.
content:
'*/*':
type: string
responses:
'200':
description: >-
Expand Down

0 comments on commit ce3645c

Please sign in to comment.