我正在尝试使用Connexion从包含OpenAPI 3.0.0规范的.yaml文件中生成Flask代码。
当我执行以下命令时:
我得到了
import connexion
app = connexion.App(__name__, specification_dir='swagger/')
app.add_api('Contato.yaml')
app.run(port=8080)我得到了这个例外:
connexion.exceptions.InvalidSpecification: {'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Contato', 'x-scope': ['']}}}} is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['get']['properties']['responses']['patternProperties']['^([0-9X]{3})$']:
{'oneOf': [{'$ref': '#/definitions/response'},
{'$ref': '#/definitions/reference'}]}
On instance['paths']['/{idContato}']['get']['responses']['200']:
{'content': {'application/json': {'schema': {'$ref': '#/components/schemas/Contato',
'x-scope': ['']}}}}.yaml文件不包含“x-scope”。这个定义是从哪里来的?我如何克服这个异常?
发布于 2019-04-05 21:45:59
我无法重现此错误,我需要更多信息,但我相信此错误已在以下位置更正:
https://github.com/Yelp/swagger_spec_validator/issues/50
在您的需求文件中添加:
swagger-spec-validator == 2.4.0
我相信它会解决
https://stackoverflow.com/questions/55348607
复制相似问题