Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specification use raw spec on clone #1830

Merged
merged 8 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion connexion/spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def enforce_string_keys(obj):
return OpenAPISpecification(spec, base_uri=base_uri)

def clone(self):
return type(self)(copy.deepcopy(self._spec))
return type(self)(copy.deepcopy(self._raw_spec))

@classmethod
def load(cls, spec, *, arguments=None):
Expand Down
12 changes: 12 additions & 0 deletions tests/api/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
from connexion.middleware import MiddlewarePosition
from connexion.options import SwaggerUIOptions
from starlette.middleware.cors import CORSMiddleware
from starlette.types import Receive, Scope, Send

Expand All @@ -22,6 +23,17 @@ def simple_openapi_app(app_class):
)


@pytest.fixture(scope="session")
def swagger_ui_app(app_class):
return build_app_from_fixture(
"simple",
app_class=app_class,
spec_file=OPENAPI3_SPEC,
validate_responses=True,
swagger_ui_options=SwaggerUIOptions(spec_path="/spec.json"),
)


@pytest.fixture(scope="session")
def cors_openapi_app(app_class):
app = build_app_from_fixture(
Expand Down
4 changes: 4 additions & 0 deletions tests/api/test_swagger_ui.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
def test_simple(swagger_ui_app):
app_client = swagger_ui_app.test_client()
response = app_client.get("/v1.0/spec.json")
assert response.status_code == 200
Loading