How to use the apispec.utils.validate_spec function in apispec

To help you get started, we’ve selected a few apispec examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github mscarey / AuthoritySpoke / tests / io / test_spec.py View on Github external
def test_validate_spec(self):
        """
        This function returns True if the spec validates against
        the OpenAPI standard.
        """
        spec = make_spec()
        assert apispec.utils.validate_spec(spec)
github marshmallow-code / apispec / tests / test_ext_marshmallow_openapi.py View on Github external
]
                ),
                "requestBody": {
                    "content": {"application/json": {"schema": CategorySchema}}
                },
                "responses": {
                    201: {
                        "description": "created",
                        "content": {"application/json": {"schema": PetSchema}},
                    }
                },
            },
        },
    )
    try:
        utils.validate_spec(spec)
    except exceptions.OpenAPIError as error:
        pytest.fail(str(error))
github marshmallow-code / apispec / tests / test_ext_marshmallow_openapi.py View on Github external
[
                        {
                            "name": "category_id",
                            "in": "path",
                            "required": True,
                            "type": "string",
                        }
                    ]
                    + openapi.schema2parameters(CategorySchema, default_in="body")
                ),
                "responses": {201: {"schema": PetSchema, "description": "A pet"}},
            },
        },
    )
    try:
        utils.validate_spec(spec)
    except exceptions.OpenAPIError as error:
        pytest.fail(str(error))