MarketSquare / roboswag

Apache License 2.0
26 stars 2 forks source link

ValidationError with Swagger Petstore v3 specification #63

Open userwizz opened 2 years ago

userwizz commented 2 years ago

Hello,

I just started to play around with this library and took Open API Petstore v3 as my starting point. Now when trying to generate code I get: prance.ValidationError: Version mismatch: selected backend "flex" does not support specified version 3.0.2!

Spec I'm using: https://petstore3.swagger.io/ --> https://petstore3.swagger.io/api/v3/openapi.json

I also tried to validate spec by calling prance directly and got same error:

$ prance.exe validate petstore_v3.json
Processing "petstore_v3.json"...
 -> Resolving external references.
ERROR in "petstore_v3.json" [ValidationError]: Version mismatch: selected backend "flex" does not support specified version 3.0.2!

But when changing backend to 'openapi-spec-validator' it works fine.

$ prance.exe validate --backend openapi-spec-validator petstore_v3.json
Processing "petstore_v3.json"...
 -> Resolving external references.
Validates OK as OpenAPI 3.0.2!

-> prance seems to use flex as default backend if flex lib is installed. --> So the question is: should roboswag library use 'openapi-spec-validator' as backend instead of 'flex' in case of v3 spec? Or am I missing something here? See also: https://prance.readthedocs.io/en/latest/#compatibility