openapi-spec-validator
openapi-spec-validator copied to clipboard
Validation fails due to AttributeError while using Python 3.12.1
- Download file
wget https://petstore.swagger.io/v2/swagger.json
- While using python 3.11
❯ openapi-spec-validator --schema detect swagger.json
OK
- While using python 3.12
❯ openapi-spec-validator --schema detect swagger.json
'_io.BufferedReader' object has no attribute 'decode'
Just encountered this erro - any chance of a resolution?
Ok - I fixed this. It always puzzled me why this code failed in 3.12 even though there are tests in the github actons for 3.12.
Removing -qq when install using pip showed that pip downgraded openapi-spec-validateor to 0.6.2 because my virtualenv also installed requests 2.29.0 and they share a common dependency. Upgrading requests module to 2.31.0 fixed the problem - openapi-spec-validator at 0.7.1 does work on 3.12.
This is new behaviour of pip - so I believe. I am only an occasional python develeoper these days and have not kept up.