- Sponsor
-
Notifications
You must be signed in to change notification settings - Fork 136
Open
Labels

Description
When writing status codes in yaml as:
reponses:
200:
description: OK
They are internally converted to integers and json_schema trips over them here. In addition this isn't caught and so the default TypeError: expected string or bytes-like object
tells you nothing.
The same schema converted to Json by ApiMatic converts status codes to strings and so the work around is to quote the response codes in your yaml file.
Metadata
Metadata
Assignees
Labels
Type
Projects
Milestone
Relationships
Development
Select code repository
Activity
p1c2u commentedon Jul 10, 2018
@mes3yd
This is openapi-spec-validator related bug
python-openapi/openapi-spec-validator#30
and should be fixed in openapi-spec-validator version 0.2.2 . Check you have latest version.
ghost commentedon Jul 10, 2018
I have 0.2.2 - but am passing the pyyaml dict to
create_spec
, as per README.md. So, not using the safe loader fromopenapi_spec_validator
.In short, I'm doing:
Can you classify this as a documentation bug? Then I'll add this to the docs.
jacobsvante commentedon Jan 9, 2019
This problem still seems to be here, even when using
openapi-spec-validator==0.2.4
:Seems that python-openapi/openapi-spec-validator#30 didn't fix the problem.
gigimon commentedon Feb 7, 2019
Any updates here? Because I have this problem too and didn't know how to resolve it
strets123 commentedon Mar 20, 2019
I suggest wrapping the string 200 with singlequotes.
plambein commentedon Oct 8, 2019
You can use
read_yaml_file
fromopenapi_spec_validator.schemas
instead ofyaml.load
. Works for me.