openapi-spec-validator icon indicating copy to clipboard operation
openapi-spec-validator copied to clipboard

Validation fails due to AttributeError while using Python 3.12.1

Open dmdhrumilmistry opened this issue 1 year ago • 1 comments

  • 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'

dmdhrumilmistry avatar Feb 01 '24 15:02 dmdhrumilmistry

Just encountered this erro - any chance of a resolution?

eccles avatar Apr 25 '24 08:04 eccles

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.

eccles avatar May 21 '24 14:05 eccles