我使用AWS API网关用户界面创建了一个简单的API(下面是swagger导出):
swagger: "2.0"
info:
version: "2017-06-15T21:29:34Z"
title: "Clone from OTAUpdate"
host: "3ks9wfuui3.execute-api.us-east-2.amazonaws.com"
basePath: "/test"
schemes:
- "https"
paths:
/users:
post:
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- in: "body"
name: "CreateUserRequest"
required: true
schema:
$ref: "#/definitions/CreateUserRequest"
responses:
200:
description: "200 response"
400:
description: "400 response"
500:
description: "500 response"
definitions:
CreateUserRequest:
type: "object"
required:
- "emailAddress"
- "password"
properties:
emailAddress:
type: "string"
description: "email address of the user"
password:
type: "string"
description: "password of the user"
title: "CreateUserRequest"
当我暂存我的API时,我可以生成除Java以外的所有 SDK。当我尝试生成Java SDK时,我收到一条错误消息:
生成SDK时出现内部错误
我做错了什么?
答案 0 :(得分:2)
在我的头撞了一会儿之后,我设法找出了这个问题的原因。在我的“模型”描述中,包括
"additionalProperties": false
直接导致了这个问题,同时删除该行解决了这个问题。
经过一些谷歌搜索,看来这是API网关服务中目前尚未解决的错误: https://forums.aws.amazon.com/thread.jspa?threadID=223666
答案 1 :(得分:0)
我也遇到了这个错误。如果它对任何人有帮助,看起来API Gateway不支持“allOf”字段。