Description: Remove openapi_spec_validator reference
 Remove references to openapi_spec_validator from tests/utils.py because
 this module is not in Debian yet.
Author: Emmanuel Arias <eamanu@debian.org>
Forwarded: not-needed
Last-Update: 2024-04-11
---
This patch header follows DEP-3: http://dep.debian.net/deps/dep3/
Index: apispec/tests/utils.py
===================================================================
--- apispec.orig/tests/utils.py
+++ apispec/tests/utils.py
@@ -1,8 +1,5 @@
 """Utilities to get elements of generated spec"""
 
-import openapi_spec_validator
-from openapi_spec_validator.exceptions import OpenAPISpecValidatorError
-
 from apispec import exceptions
 from apispec.core import APISpec
 from apispec.utils import build_reference
@@ -48,18 +45,3 @@ def get_paths(spec):
 
 def build_ref(spec, component_type, obj):
     return build_reference(component_type, spec.openapi_version.major, obj)
-
-
-def validate_spec(spec: APISpec) -> bool:
-    """Validate the output of an :class:`APISpec` object against the
-    OpenAPI specification.
-
-    :raise: apispec.exceptions.OpenAPIError if validation fails.
-    """
-    try:
-        # Coerce to dict to satisfy Pyright
-        openapi_spec_validator.validate(dict(spec.to_dict()))
-    except OpenAPISpecValidatorError as err:
-        raise exceptions.OpenAPIError(*err.args) from err
-    else:
-        return True
Index: apispec/tests/test_ext_marshmallow_openapi.py
===================================================================
--- apispec.orig/tests/test_ext_marshmallow_openapi.py
+++ apispec/tests/test_ext_marshmallow_openapi.py
@@ -8,7 +8,7 @@ from apispec import APISpec, exceptions
 from apispec.ext.marshmallow import MarshmallowPlugin, OpenAPIConverter
 
 from .schemas import CustomList, CustomStringField
-from .utils import build_ref, get_schemas, validate_spec
+from .utils import build_ref, get_schemas
 
 
 class TestMarshmallowFieldToOpenAPI:
@@ -487,134 +487,6 @@ class TestNesting:
         assert "breed" not in category_props
 
 
-def test_openapi_tools_validate_v2():
-    ma_plugin = MarshmallowPlugin()
-    spec = APISpec(
-        title="Pets", version="0.1", plugins=(ma_plugin,), openapi_version="2.0"
-    )
-    openapi = ma_plugin.converter
-    assert openapi is not None
-
-    spec.components.schema("Category", schema=CategorySchema)
-    spec.components.schema("Pet", {"discriminator": "name"}, schema=PetSchema)
-
-    spec.path(
-        view=None,
-        path="/category/{category_id}",
-        operations={
-            "get": {
-                "parameters": [
-                    {"name": "q", "in": "query", "type": "string"},
-                    {
-                        "name": "category_id",
-                        "in": "path",
-                        "required": True,
-                        "type": "string",
-                    },
-                    openapi._field2parameter(
-                        field=fields.List(
-                            fields.Str(),
-                            validate=validate.OneOf(["freddie", "roger"]),
-                        ),
-                        location="query",
-                        name="body",
-                    ),
-                ]
-                + openapi.schema2parameters(PageSchema, location="query"),
-                "responses": {200: {"schema": PetSchema, "description": "A pet"}},
-            },
-            "post": {
-                "parameters": (
-                    [
-                        {
-                            "name": "category_id",
-                            "in": "path",
-                            "required": True,
-                            "type": "string",
-                        }
-                    ]
-                    + openapi.schema2parameters(CategorySchema, location="body")
-                ),
-                "responses": {201: {"schema": PetSchema, "description": "A pet"}},
-            },
-        },
-    )
-    try:
-        validate_spec(spec)
-    except exceptions.OpenAPIError as error:
-        pytest.fail(str(error))
-
-
-def test_openapi_tools_validate_v3():
-    ma_plugin = MarshmallowPlugin()
-    spec = APISpec(
-        title="Pets", version="0.1", plugins=(ma_plugin,), openapi_version="3.0.0"
-    )
-    openapi = ma_plugin.converter
-    assert openapi is not None
-
-    spec.components.schema("Category", schema=CategorySchema)
-    spec.components.schema("Pet", schema=PetSchema)
-
-    spec.path(
-        view=None,
-        path="/category/{category_id}",
-        operations={
-            "get": {
-                "parameters": [
-                    {"name": "q", "in": "query", "schema": {"type": "string"}},
-                    {
-                        "name": "category_id",
-                        "in": "path",
-                        "required": True,
-                        "schema": {"type": "string"},
-                    },
-                    openapi._field2parameter(
-                        field=fields.List(
-                            fields.Str(),
-                            validate=validate.OneOf(["freddie", "roger"]),
-                        ),
-                        location="query",
-                        name="body",
-                    ),
-                ]
-                + openapi.schema2parameters(PageSchema, location="query"),
-                "responses": {
-                    200: {
-                        "description": "success",
-                        "content": {"application/json": {"schema": PetSchema}},
-                    }
-                },
-            },
-            "post": {
-                "parameters": (
-                    [
-                        {
-                            "name": "category_id",
-                            "in": "path",
-                            "required": True,
-                            "schema": {"type": "string"},
-                        }
-                    ]
-                ),
-                "requestBody": {
-                    "content": {"application/json": {"schema": CategorySchema}}
-                },
-                "responses": {
-                    201: {
-                        "description": "created",
-                        "content": {"application/json": {"schema": PetSchema}},
-                    }
-                },
-            },
-        },
-    )
-    try:
-        validate_spec(spec)
-    except exceptions.OpenAPIError as error:
-        pytest.fail(str(error))
-
-
 def test_openapi_converter_openapi_version_types():
     spec = APISpec(title="Pets", version="0.1", openapi_version="2.0")
     converter_with_version = OpenAPIConverter(Version("3.1"), None, spec)
