APIGateway: Fix openapi-spec-validator import error (#5458)

This commit is contained in:
Brian Pandola 2022-09-09 02:14:03 -07:00 committed by GitHub
parent f61ffc81ec
commit 4a9b4b2743
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View File

@ -17,6 +17,7 @@ jobs:
responses-version: ["0.13.0", "0.15.0", "0.17.0", "0.19.0", "0.20.0" ]
mock-version: [ "3.0.5", "4.0.0", "4.0.3" ]
werkzeug-version: ["2.0.1", "2.1.1"]
openapi-spec-validator-version: ["0.4.0", "0.5.0"]
steps:
- name: Checkout repository
@ -37,6 +38,7 @@ jobs:
pip install responses==${{ matrix.responses-version }}
pip install mock==${{ matrix.mock-version }}
pip install werkzeug==${{ matrix.werkzeug-version }}
pip install openapi-spec-validator==${{ matrix.openapi-spec-validator-version }}
- name: Run tests
run: |

View File

@ -12,7 +12,11 @@ import time
from urllib.parse import urlparse
import responses
from openapi_spec_validator.exceptions import OpenAPIValidationError
try:
from openapi_spec_validator.validation.exceptions import OpenAPIValidationError
except ImportError:
# OpenAPI Spec Validator < 0.5.0
from openapi_spec_validator.exceptions import OpenAPIValidationError
from moto.core import BaseBackend, BaseModel, CloudFormationModel
from .utils import create_id, to_path
from moto.core.utils import path_url, BackendDict