swagger
APIGateway

API Gateway ImporterでswaggerのファイルをインポートしてBadRequestExceptionが出た場合の対処

More than 3 years have passed since last update.

API Gateway ImporterでswaggerのファイルをインポートしてBadRequestExceptionが出た場合の対処

responsesのdescriptionが日本語だとエラーが発生するので英語に変更すればOK

responsesのdescriptionはAPI GatewayのModelsのNameとして利用されいているみたいです


エラー発生時のswagger.yamlの抜粋

      responses:

'200':
description: 日本語のコメント
schema:
type: object
properties:
metadata:
$ref: '#/definitions/MetaData'
result:
type: object
properties:
realestate_article:
type: array
items:
$ref: '#/definitions/RealestateArticle'


修正後のswagger.yamlの抜粋

      responses:

'200':
description: in success
schema:
type: object
properties:
metadata:
$ref: '#/definitions/MetaData'
result:
type: object
properties:
realestate_article:
type: array
items:
$ref: '#/definitions/RealestateArticle'


エラー内容

com.amazonaws.services.apigateway.model.BadRequestException: Invalid model name specified: application/json=null (Service: null; Status Code: 400; Error Co

de: null; Request ID: sample-sample-samplesample)
at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1275)
at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:873)
at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:576)
at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:362)
at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:328)
at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:307)
at com.amazonaws.hal.client.HalClient.invoke(HalClient.java:235)
at com.amazonaws.hal.client.HalClient.putResource(HalClient.java:122)
at com.amazonaws.hal.client.HalResourceInvocationHandler.invoke(HalResourceInvocationHandler.java:125)
at com.sun.proxy.$Proxy33.putMethodResponse(Unknown Source)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.lambda$createMethodResponses$11(ApiGatewaySdkSwaggerApiImport
er.java:515)
at java.util.LinkedHashMap$LinkedEntrySet.forEach(LinkedHashMap.java:663)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.createMethodResponses(ApiGatewaySdkSwaggerApiImporter.java:50
8)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.createMethod(ApiGatewaySdkSwaggerApiImporter.java:237)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.lambda$createMethods$3(ApiGatewaySdkSwaggerApiImporter.java:1
77)
at java.util.HashMap$EntrySet.forEach(HashMap.java:1035)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.createMethods(ApiGatewaySdkSwaggerApiImporter.java:176)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.createResources(ApiGatewaySdkSwaggerApiImporter.java:168)
at com.amazonaws.service.apigateway.importer.impl.sdk.ApiGatewaySdkSwaggerApiImporter.createApi(ApiGatewaySdkSwaggerApiImporter.java:69)
at com.amazonaws.service.apigateway.importer.impl.ApiGatewaySwaggerFileImporter.importApi(ApiGatewaySwaggerFileImporter.java:48)
at com.amazonaws.service.apigateway.importer.ApiImporterMain.importSwagger(ApiImporterMain.java:155)
at com.amazonaws.service.apigateway.importer.ApiImporterMain.execute(ApiImporterMain.java:145)
at com.amazonaws.service.apigateway.importer.ApiImporterMain.main(ApiImporterMain.java:83)