prance icon indicating copy to clipboard operation
prance copied to clipboard

ImportError: cannot import name 'validate_v2_spec' from 'openapi_spec_validator'

Open kasium opened this issue 2 years ago • 4 comments

Expected Behaviour

Import works

Minimal Example Spec

  • Install prance and run a validation
  • Install openapi_spec_validator 0.5.0

Actual Behaviour

cannot import name 'validate_v2_spec' from 'openapi_spec_validator'

kasium avatar Sep 02 '22 10:09 kasium

It looks like the usage changed in openapi-spec-validator 0.5.0.

# Before
from openapi_spec_validator import validate_v2_spec
validate_v2_spec(spec)

# After
from openapi_spec_validator import validate_spec, openapi_v2_spec_validator
validate_spec(spec, validator=openapi_v2_spec_validator)

jacobtomlinson avatar Sep 02 '22 13:09 jacobtomlinson

Pinning openapi-spec-validator to 0.4 fixed the issue for me!

hectorakemp avatar Sep 05 '22 05:09 hectorakemp

Hi, is there any update on this?

Milind-TW avatar Sep 13 '22 09:09 Milind-TW

The related packages openapi-core / openapi-spec-validator and openapi-schema-validator were updated the past few months to add support for OAS v3.1. The breaking changes are unfortunate, but updating prance to work with openapi_spec_validator 0.5 is probably a bit step towards OAS 3.1 support.

robinmackaij-kadaster avatar Sep 16 '22 10:09 robinmackaij-kadaster

@RonnyPfannschmidt if you have some time, a release would be great 😄

kasium avatar Oct 17 '22 06:10 kasium