diff --git a/packages/cli/generators/openapi/spec-helper.js b/packages/cli/generators/openapi/spec-helper.js index 544227f13f18..b38e8ea273f5 100644 --- a/packages/cli/generators/openapi/spec-helper.js +++ b/packages/cli/generators/openapi/spec-helper.js @@ -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; } } diff --git a/packages/cli/snapshots/integration/generators/openapi-uspto.integration.snapshots.js b/packages/cli/snapshots/integration/generators/openapi-uspto.integration.snapshots.js index 84a01c2450e3..f22413071627 100644 --- a/packages/cli/snapshots/integration/generators/openapi-uspto.integration.snapshots.js +++ b/packages/cli/snapshots/integration/generators/openapi-uspto.integration.snapshots.js @@ -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. */ @@ -361,6 +362,16 @@ to consume. default: 'v1', }, }, + { + name: 'page', + in: 'query', + description: 'Page you would like to fetch.', + content: { + '*/*': { + type: 'string', + }, + }, + }, ], responses: { '200': { @@ -403,7 +414,16 @@ to consume. type: 'string', default: 'v1', }, -}) version: string): Promise { +}) version: string, @param({ + name: 'page', + in: 'query', + description: 'Page you would like to fetch.', + content: { + '*/*': { + type: 'string', + }, + }, +}) page: string | undefined): Promise { throw new Error('Not implemented'); } } @@ -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. */ @@ -561,6 +582,16 @@ to consume. default: 'v1', }, }, + { + name: 'page', + in: 'query', + description: 'Page you would like to fetch.', + content: { + '*/*': { + type: 'string', + }, + }, + }, ], responses: { '200': { @@ -603,7 +634,16 @@ to consume. type: 'string', default: 'v1', }, -}) version: string): Promise { +}) version: string, @param({ + name: 'page', + in: 'query', + description: 'Page you would like to fetch.', + content: { + '*/*': { + type: 'string', + }, + }, +}) page: string | undefined): Promise { throw new Error('Not implemented'); } } diff --git a/packages/cli/test/fixtures/openapi/3.0/uspto.yaml b/packages/cli/test/fixtures/openapi/3.0/uspto.yaml index 5489760ac06a..4e9f9cc1bce3 100644 --- a/packages/cli/test/fixtures/openapi/3.0/uspto.yaml +++ b/packages/cli/test/fixtures/openapi/3.0/uspto.yaml @@ -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: >-