Repository navigation
'_io.BufferedReader' object has no attribute 'decode' #209
Copy link
Copy link
Closed
Description
I get the error message without an traceback when executing:
# python3 -m openapi_spec_validator openapi.json
'_io.BufferedReader' object has no attribute 'decode'
# python3 --version
Python 3.7.3
Requirement already satisfied: openapi-spec-validator in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (0.5.6)
Requirement already satisfied: importlib-resources<6.0.0,>=5.8.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (5.12.0)
Requirement already satisfied: jsonschema<4.18.0,>=4.0.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (4.17.3)
Requirement already satisfied: jsonschema-spec<0.2.0,>=0.1.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (0.1.4)
Requirement already satisfied: lazy-object-proxy<2.0.0,>=1.7.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (1.9.0)
Requirement already satisfied: openapi-schema-validator<0.5.0,>=0.4.2 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-spec-validator) (0.4.4)
Requirement already satisfied: zipp>=3.1.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from importlib-resources<6.0.0,>=5.8.0->openapi-spec-validator) (3.15.0)
Requirement already satisfied: attrs>=17.4.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (23.1.0)
Requirement already satisfied: importlib-metadata in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (6.6.0)
Requirement already satisfied: pkgutil-resolve-name>=1.3.10 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (1.3.10)
Requirement already satisfied: pyrsistent!=0.17.0,!=0.17.1,!=0.17.2,>=0.14.0 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (0.19.3)
Requirement already satisfied: typing-extensions in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema<4.18.0,>=4.0.0->openapi-spec-validator) (4.6.3)
Requirement already satisfied: PyYAML>=5.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema-spec<0.2.0,>=0.1.1->openapi-spec-validator) (6.0)
Requirement already satisfied: pathable<0.5.0,>=0.4.1 in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from jsonschema-spec<0.2.0,>=0.1.1->openapi-spec-validator) (0.4.3)
Requirement already satisfied: rfc3339-validator in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from openapi-schema-validator<0.5.0,>=0.4.2->openapi-spec-validator) (0.1.4)
Requirement already satisfied: six in ./ucs-test-udm-rest-api/lib/python3.7/site-packages (from rfc3339-validator->openapi-schema-validator<0.5.0,>=0.4.2->openapi-spec-validator) (1.16.0)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
spaceone commentedon Jun 6, 2023
got the traceback with some debugging:
spaceone commentedon Jun 6, 2023
work with an old version:
python3 -m pip install openapi-spec-validator==0.4.0 jsonschema-spec==0.1.4p1c2u commentedon Jun 10, 2023
Hi @spaceone ,
I can;t reproduce it. Can you prepare minimal example to reproduce the issue?
spaceone commentedon Jun 10, 2023
The exact code we execute is:
https://github.com/univention/univention-corporate-server/blob/87d92592015822ef25b3d052a6b7206295d0e462~/test/ucs-test/tests/73_udm-rest/01_openapi_validation
Our workaround is:
https://github.com/univention/univention-corporate-server/blob/87d92592015822ef25b3d052a6b7206295d0e462/test/ucs-test/tests/73_udm-rest/01_openapi_validation
The content of
openapi.jsonis irrelevant, as that file is not yet used.p1c2u commentedon Jun 10, 2023
p1c2u/jsonschema-path#14
Temporary workaround will be downgrading typing-extensions to version below 4.6:
spaceone commentedon Jun 10, 2023
wonderful, thanks!
ambadyanands commentedon Jun 17, 2024
Unfortuantely this breaks compatibility with
pydanticnow.Any idea about what would be a proper solution that will work with latest/recent version of the dependencies?
Here's the related issue for reference, if it helps:
https://gitlab.com/gnukhata/gkcore/-/issues/745
Edit:
I mixed up the issues on downgrading
openapi-spec-validatorwith the issues on downgradingtyping-extensions. The downgrade related issue regarding the latter is withpydantic. Updated the error message above to fix the same.