Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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)
]
),
"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))
[
{
"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))