Python 3.x 如何修复此错误?验证失败';其中之一';在模式中
我正在使用Flask、Connexion和SQLAlchemy创建一个API来访问数据库。为此,我需要以下依赖项:Python 3.x 如何修复此错误?验证失败';其中之一';在模式中,python-3.x,sqlalchemy,swagger-2.0,marshmallow,connexion,Python 3.x,Sqlalchemy,Swagger 2.0,Marshmallow,Connexion,我正在使用Flask、Connexion和SQLAlchemy创建一个API来访问数据库。为此,我需要以下依赖项: 烧瓶炼金术 摇瓶棉花糖 棉花糖炼金术 棉花糖 当我使用命令python3运行带有应用程序实例的文件时,产生了以下错误: Traceback (most recent call last): File "server.py", line 16, in <module> connex_app.add_api("swagger.yml") File "/hom
python3
运行带有应用程序实例的文件时,产生了以下错误:
Traceback (most recent call last):
File "server.py", line 16, in <module>
connex_app.add_api("swagger.yml")
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/apps/flask_app.py", line 57, in add_api
api = super(FlaskApp, self).add_api(specification, **kwargs)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/apps/abstract.py", line 153, in add_api
options=api_options.as_dict())
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/apis/abstract.py", line 75, in __init__
self.specification = Specification.load(specification, arguments=arguments)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/spec.py", line 153, in load
return cls.from_file(spec, arguments=arguments)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/spec.py", line 107, in from_file
return cls.from_dict(spec)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/spec.py", line 144, in from_dict
return Swagger2Specification(spec)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/spec.py", line 38, in __init__
self._validate_spec(raw_spec)
File "/home/fidelis/repo/proj4/env/lib/python3.6/site-packages/connexion/spec.py", line 214, in _validate_spec
raise InvalidSpecification.create_from(e)
connexion.exceptions.InvalidSpecification: None is not valid under any of the given schemas
Failed validating 'oneOf' in schema['properties']['paths']['patternProperties']['^/']['properties']['delete']['properties']['responses']['patternProperties']['^([0-9]{3})$|^(default)$']:
{'oneOf': [{'$ref': '#/definitions/response'},
{'$ref': '#/definitions/jsonReference'}]}
On instance['paths']['/people/{person_id}']['delete']['responses']['200']:
我不知道如何解决这个错误。我忘了在删除响应200的正下方包含描述。这是我忘记的一行
description: successfully deleted a person
您可以尝试将people.delete响应代码从200更改为204吗?我认为这可能是您的状态代码和http verbi的一个小错误,并排除了delete 200(确定)响应下面的描述部分。这导致了错误。很难相信,但这个答案确实帮助了我:D.我正为这个问题绞尽脑汁,结果发现,当你没有
描述字符串作为回答时,这个愚蠢的东西会吐出来。想象一下:/
description: successfully deleted a person