manchenkoff / openapi3-parser

OpenAPI 3 parser to use a specification inside of the code in your projects
https://pypi.org/project/openapi3-parser/
MIT License
65 stars 34 forks source link

[BUG] RuntimeError: No validation backend available! Install one of "flex", "openapi-spec-validator" or "swagger-spec-validator". #70

Closed ajatkj closed 1 year ago

ajatkj commented 1 year ago

Describe the bug Running into below error when I try to parse openapi data.

RuntimeError: No validation backend available! Install one of "flex", "openapi-spec-validator" or "swagger-spec-validator".

Upon further investigation, found this error which is thrown from openapi-schema-validator which is a dependency of openapi-spec-validator-

Import or syntax error cannot import name '_legacy_validators' from 'jsonschema'

I am not sure how to proceed further with this because even after installing other back-end "flex" it raises exception the same exception.

Let me know if I am missing something here.

To Reproduce

  1. Install openapi3-parser
  2. Write a simple sample program
    
    from openapi_parser import parse

parse("sample.yaml")


3. Run the program (throws exception)
4. Install "flex" backend
5. Run the sample program again (throws exception)

**Expected behavior**
A clear and concise description of what you expected to happen.

**System details (please complete the following information):**
 - OS: macOS 13.4.1
 - OpenAPI / Swagger version 3.1.0
 - Python version 3.11

**Additional context**
Add any other context about the problem here.
manchenkoff commented 1 year ago

Hey @ajatkj, found this issue in the actual repo of the project I used as a dependency, could you check if installing openapi-schema-validator with 0.1.3 version or higher helps?

Link to the issue - https://github.com/python-openapi/openapi-spec-validator/issues/112

ajatkj commented 1 year ago

Hi @manchenkoff, upgrading openapi-spec-validator to v0.6.0 solves this issue. This in turn updates openapi-schema-validator to v0.6.1 which handles the latest jsonschema version. Should I raise a PR to bump openapi-spec-validator version to v0.6.0?

manchenkoff commented 1 year ago

@ajatkj that would be nice, thanks!

manchenkoff commented 1 year ago

@ajatkj merged and published as v1.1.14, thanks for the contribution!