我正在尝试使用 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”。这个定义从何而来?我怎样才能克服这个异常?