ACSBP-3718 Update to use openapi 3.1 #253
130 tests run, 114 passed, 0 skipped, 16 failed.
Annotations
Check failure on line 1 in RebarTest
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
RebarTest.test_rebar_can_be_url_prefixed
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc867edd0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
self = <tests.test_rebar.RebarTest testMethod=test_rebar_can_be_url_prefixed>
def test_rebar_can_be_url_prefixed(self):
app = Flask(__name__)
app.testing = True
rebar = Rebar()
registry_v1 = rebar.create_handler_registry(prefix="v1")
registry_v2 = rebar.create_handler_registry(
prefix="/v2/"
) # Slashes shouldn't matter
# We use the same endpoint to show that the swagger operationId gets set correctly
# and the Flask endpoint gets prefixed
register_endpoint(registry=registry_v1, endpoint="get_foo")
register_endpoint(registry=registry_v2, endpoint="get_foo")
rebar.init_app(app)
for prefix in ("v1", "v2"):
resp = app.test_client().get(prefix_url(prefix=prefix, url="/swagger/ui/"))
self.assertEqual(resp.status_code, 200)
swagger = get_swagger(test_client=app.test_client(), prefix=prefix)
> validate_swagger(swagger)
tests/test_rebar.py:708:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:49: in additionalProperties
for error in validator.descend(instance[extra], aP, path=extra):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc867edd0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 1 in RebarTest
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
RebarTest.test_swagger_can_be_set_to_v3
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
self = <tests.test_rebar.RebarTest testMethod=test_swagger_can_be_set_to_v3>
def test_swagger_can_be_set_to_v3(self):
rebar = Rebar()
rebar.create_handler_registry(swagger_generator=SwaggerV3Generator())
app = create_rebar_app(rebar)
resp = app.test_client().get("/swagger")
self.assertEqual(resp.status_code, 200)
> validate_swagger(resp.json, SWAGGER_V3_JSONSCHEMA)
tests/test_rebar.py:567:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 1 in RebarTest
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
RebarTest.test_swagger_endpoint_is_automatically_created
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc8701110>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
self = <tests.test_rebar.RebarTest testMethod=test_swagger_endpoint_is_automatically_created>
def test_swagger_endpoint_is_automatically_created(self):
rebar = Rebar()
rebar.create_handler_registry()
app = create_rebar_app(rebar)
resp = app.test_client().get("/swagger")
self.assertEqual(resp.status_code, 200)
> validate_swagger(resp.json)
tests/test_rebar.py:542:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:49: in additionalProperties
for error in validator.descend(instance[extra], aP, path=extra):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc8701110>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 110 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_v2_generator_non_registry_parameters
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc85e1b50>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
def test_swagger_v2_generator_non_registry_parameters():
host = "localhost"
schemes = ["http"]
consumes = ["application/json"]
produces = ["application/json"]
title = "Test API"
version = "2.1.0"
description = "Foo Bar Baz"
class Error(m.Schema):
message = m.fields.String()
details = m.fields.Dict()
generator = SwaggerV2Generator(
host=host,
schemes=schemes,
consumes=consumes,
produces=produces,
title=title,
version=version,
description=description,
default_response_schema=Error(),
tags=[
Tag(
name="bar",
description="baz",
external_docs=ExternalDocumentation(
url="http://bardocs.com", description="qux"
),
)
],
)
rebar = Rebar()
registry = rebar.create_handler_registry()
swagger = generator.generate(registry)
expected_swagger = {
"swagger": "2.0",
"host": host,
"info": {"title": title, "version": version, "description": description},
"schemes": schemes,
"consumes": consumes,
"produces": produces,
"securityDefinitions": {},
"tags": [
{
"name": "bar",
"description": "baz",
"externalDocs": {"url": "http://bardocs.com", "description": "qux"},
}
],
"paths": {},
"definitions": {
"Error": {
"additionalProperties": False,
"type": "object",
"title": "Error",
"properties": {
"message": {"type": "string"},
"details": {"type": "object"},
},
}
},
}
> validate_swagger(expected_swagger)
tests/swagger_generation/test_swagger_generator.py:110:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:49: in additionalProperties
for error in validator.descend(instance[extra], aP, path=extra):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc85e1b50>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 198 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_v3_generator_non_registry_parameters
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
def test_swagger_v3_generator_non_registry_parameters():
title = "Test API"
version = "3.1.0"
description = "testing testing 123"
class Error(m.Schema):
message = m.fields.String()
details = m.fields.Dict()
generator = SwaggerV3Generator(
version=version,
title=title,
description=description,
default_response_schema=Error(),
tags=[
Tag(
name="bar",
description="baz",
external_docs=ExternalDocumentation(
url="http://bardocs.com", description="qux"
),
)
],
servers=[
Server(
url="https://{username}.gigantic-server.com:{port}/{basePath}",
description="The production API server",
variables={
"username": ServerVariable(
default="demo",
description="this value is assigned by the service provider: `gigantic-server.com`",
),
"port": ServerVariable(default="8443", enum=["8443", "443"]),
"basePath": ServerVariable(default="v2"),
},
)
],
)
rebar = Rebar()
registry = rebar.create_handler_registry()
swagger = generator.generate(registry)
expected_swagger = {
"openapi": "3.1.0",
"info": {"title": title, "version": version, "description": description},
"tags": [
{
"name": "bar",
"description": "baz",
"externalDocs": {"url": "http://bardocs.com", "description": "qux"},
}
],
"servers": [
{
"url": "https://{username}.gigantic-server.com:{port}/{basePath}",
"description": "The production API server",
"variables": {
"username": {
"default": "demo",
"description": "this value is assigned by the service provider: `gigantic-server.com`",
},
"port": {"enum": ["8443", "443"], "default": "8443"},
"basePath": {"default": "v2"},
},
}
],
"paths": {},
"components": {
"schemas": {
"Error": {
"additionalProperties": False,
"type": "object",
"title": "Error",
"properties": {
"message": {"type": "string"},
"details": {"type": "object"},
},
}
}
},
}
> validate_swagger(expected_swagger, SWAGGER_V3_JSONSCHEMA)
tests/swagger_generation/test_swagger_generator.py:198:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry0-swagger_generator0-expected_swagger0]
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc855fd10>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8c40750>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v2.SwaggerV2Generator object at 0x7f3cc8a5a490>
expected_swagger = {'consumes': ['application/json'], 'definitions': {'Error': {'additionalProperties': False, 'properties': {'errors': {...ema', 'type': 'object'}}, 'host': 'localhost', 'info': {'description': '', 'title': 'My API', 'version': '1.0.0'}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc855fd10>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry1-swagger_generator1-expected_swagger1]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8c40750>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc8b46e90>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': 'tagged_foos', 'responses': {'default': {'content': {...}, 'description': 'Error'}}, 'tags': ['bar', 'baz']}}}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry2-swagger_generator2-expected_swagger2]
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc85d11d0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8971590>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v2.SwaggerV2Generator object at 0x7f3cc8973e10>
expected_swagger = {'consumes': ['application/json'], 'definitions': {'Error': {'additionalProperties': False, 'properties': {'errors': {... 'title': 'Error', ...}}, 'host': 'localhost', 'info': {'description': '', 'title': 'My API', 'version': '1.0.0'}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:49: in additionalProperties
for error in validator.descend(instance[extra], aP, path=extra):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc85d11d0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry3-swagger_generator3-expected_swagger3]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8971590>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc8971a50>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': True, 'in': 'query', 'name': 'foos', ...}], 'responses': {'default': {'content': {...}, 'description': 'Error'}}}}}}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry4-swagger_generator4-expected_swagger4]
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc82282d0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc84f55d0>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v2.SwaggerV2Generator object at 0x7f3cc8da1f10>
expected_swagger = {'consumes': ['application/json'], 'definitions': {'Error': {'additionalProperties': False, 'properties': {'errors': {...ema', 'type': 'object'}}, 'host': 'localhost', 'info': {'description': '', 'title': 'My API', 'version': '1.0.0'}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc82282d0>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry5-swagger_generator5-expected_swagger5]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc84f55d0>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc84f42d0>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': 'tagged_foos', 'responses': {'default': {'content': {...}, 'description': 'Error'}}, 'tags': ['bar', 'baz']}}}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry6-swagger_generator6-expected_swagger6]
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc83f3a50>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8970310>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v2.SwaggerV2Generator object at 0x7f3cc8965310>
expected_swagger = {'consumes': ['application/json'], 'definitions': {'Error': {'additionalProperties': False, 'properties': {'errors': {...ema', 'type': 'object'}}, 'host': 'localhost', 'info': {'description': '', 'title': 'My API', 'version': '1.0.0'}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:49: in additionalProperties
for error in validator.descend(instance[extra], aP, path=extra):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc83f3a50>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/title'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/title'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 265 in tests/swagger_generation/test_swagger_generator.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator.test_swagger_generators[registry7-swagger_generator7-expected_swagger7]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8970310>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc8965550>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': 'tagged_foos', 'responses': {'default': {'content': {...}, 'description': 'Error'}}, 'tags': ['bar', 'baz']}}}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(legacy.registry, legacy.swagger_v2_generator, legacy.EXPECTED_SWAGGER_V2),
(legacy.registry, legacy.swagger_v3_generator, legacy.EXPECTED_SWAGGER_V3),
(
exploded_query_string.registry,
exploded_query_string.swagger_v2_generator,
exploded_query_string.EXPECTED_SWAGGER_V2,
),
(
exploded_query_string.registry,
exploded_query_string.swagger_v3_generator,
exploded_query_string.EXPECTED_SWAGGER_V3,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v2_generator,
multiple_authenticators.EXPECTED_SWAGGER_V2,
),
(
multiple_authenticators.registry,
multiple_authenticators.swagger_v3_generator,
multiple_authenticators.EXPECTED_SWAGGER_V3,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v2_generator,
marshmallow_objects.EXPECTED_SWAGGER_V2,
),
(
marshmallow_objects.registry,
marshmallow_objects.swagger_v3_generator,
marshmallow_objects.EXPECTED_SWAGGER_V3,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator.py:265:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 57 in tests/swagger_generation/test_swagger_generator_hidden_api.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator_hidden_api.test_swagger_generators[registry0-swagger_generator0-expected_swagger0]
jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
Raw output
self = <jsonschema.validators.RefResolver object at 0x7f3cc8496650>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
> document = document[part]
E KeyError: 'type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:776: KeyError
During handling of the above exception, another exception occurred:
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8945e90>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v2.SwaggerV2Generator object at 0x7f3cc8945950>
expected_swagger = {'consumes': ['application/json'], 'definitions': {'Error': {'additionalProperties': False, 'properties': {'errors': {...ema', 'type': 'object'}}, 'host': 'localhost', 'info': {'description': '', 'title': 'My API', 'version': '1.0.0'}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(
hidden_api.registry,
hidden_api.swagger_v2_generator,
hidden_api.EXPECTED_SWAGGER_V2,
),
(
hidden_api.registry,
hidden_api.normal_swagger_v3_generator,
hidden_api.SWAGGER_V3_WITHOUT_HIDDEN,
),
(
hidden_api.registry,
hidden_api.swagger_v3_generator_with_hidden,
hidden_api.SWAGGER_V3_WITH_HIDDEN,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator_hidden_api.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:897: in validate
error = exceptions.best_match(validator.iter_errors(instance))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/exceptions.py:293: in best_match
best = next(errors, None)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:23: in patternProperties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:337: in oneOf
errs = list(validator.descend(instance, subschema, schema_path=index))
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:263: in ref
for error in validator.descend(instance, resolved):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:282: in properties
for error in validator.descend(
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:339: in descend
for error in self.iter_errors(instance, schema):
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:323: in iter_errors
for error in errors:
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/_validators.py:259: in ref
scope, resolved = validator.resolver.resolve(ref)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:734: in resolve
return url, self._remote_cache(url)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:746: in resolve_from_url
return self.resolve_fragment(document, fragment)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <jsonschema.validators.RefResolver object at 0x7f3cc8496650>
document = {'basePath': {'description': "The base path to the API. Example: '/api'.", 'pattern': '^/', 'type': 'string'}, 'consum....'}, 'definitions': {'$ref': '#/definitions/definitions'}, 'externalDocs': {'$ref': '#/definitions/externalDocs'}, ...}
fragment = 'properties/type'
def resolve_fragment(self, document, fragment):
"""
Resolve a ``fragment`` within the referenced ``document``.
Arguments:
document:
The referent document
fragment (str):
a URI fragment to resolve within it
"""
fragment = fragment.lstrip(u"/")
parts = unquote(fragment).split(u"/") if fragment else []
for part in parts:
part = part.replace(u"~1", u"/").replace(u"~0", u"~")
if isinstance(document, Sequence):
# Array indexes should be turned into integers
try:
part = int(part)
except ValueError:
pass
try:
document = document[part]
except (TypeError, LookupError):
> raise exceptions.RefResolutionError(
"Unresolvable JSON pointer: %r" % fragment
)
E jsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'properties/type'
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:778: RefResolutionError
Check failure on line 57 in tests/swagger_generation/test_swagger_generator_hidden_api.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator_hidden_api.test_swagger_generators[registry1-swagger_generator1-expected_swagger1]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8945e90>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc87913d0>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': 'tagged_foos', 'responses': {'default': {'content': {...}, 'description': 'Error'}}, 'tags': ['bar', 'baz']}}}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(
hidden_api.registry,
hidden_api.swagger_v2_generator,
hidden_api.EXPECTED_SWAGGER_V2,
),
(
hidden_api.registry,
hidden_api.normal_swagger_v3_generator,
hidden_api.SWAGGER_V3_WITHOUT_HIDDEN,
),
(
hidden_api.registry,
hidden_api.swagger_v3_generator_with_hidden,
hidden_api.SWAGGER_V3_WITH_HIDDEN,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator_hidden_api.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning
Check failure on line 57 in tests/swagger_generation/test_swagger_generator_hidden_api.py
github-actions / JUnit Report python3.11 marshmallow>3.18.0 flask=='2.3.*' werkzeug=='2.3.*'
test_swagger_generator_hidden_api.test_swagger_generators[registry2-swagger_generator2-expected_swagger2]
DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
Raw output
registry = <flask_rebar.rebar.HandlerRegistry object at 0x7f3cc8945e90>
swagger_generator = <flask_rebar.swagger_generation.swagger_generator_v3.SwaggerV3Generator object at 0x7f3cc8946e10>
expected_swagger = {'components': {'schemas': {'Error': {'additionalProperties': False, 'properties': {'errors': {'type': 'object'}, 'mes...': 'tagged_foos', 'responses': {'default': {'content': {...}, 'description': 'Error'}}, 'tags': ['bar', 'baz']}}}, ...}
@pytest.mark.parametrize(
"registry, swagger_generator, expected_swagger",
[
(
hidden_api.registry,
hidden_api.swagger_v2_generator,
hidden_api.EXPECTED_SWAGGER_V2,
),
(
hidden_api.registry,
hidden_api.normal_swagger_v3_generator,
hidden_api.SWAGGER_V3_WITHOUT_HIDDEN,
),
(
hidden_api.registry,
hidden_api.swagger_v3_generator_with_hidden,
hidden_api.SWAGGER_V3_WITH_HIDDEN,
),
],
)
def test_swagger_generators(registry, swagger_generator, expected_swagger):
open_api_version = swagger_generator.get_open_api_version()
if open_api_version == "2.0":
swagger_jsonschema = SWAGGER_V2_JSONSCHEMA
elif open_api_version == "3.1.0":
swagger_jsonschema = SWAGGER_V3_JSONSCHEMA
else:
raise ValueError("Unknown swagger_version: {}".format(open_api_version))
> validate_swagger(expected_swagger, schema=swagger_jsonschema)
tests/swagger_generation/test_swagger_generator_hidden_api.py:57:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
flask_rebar/testing/__init__.py:14: in validate_swagger
jsonschema.validate(instance=swagger, schema=schema)
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:893: in validate
cls = validator_for(schema)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
schema = {'$defs': {'callbacks': {'$comment': 'https://spec.openapis.org/oas/v3.1.0#callback-object', '$ref': '#/$defs/specific...ut/schema', '$ref': '#/$defs/specification-extensions', '$schema': 'https://json-schema.org/draft/2020-12/schema', ...}
default = <class 'jsonschema.validators.create.<locals>.Validator'>
def validator_for(schema, default=_LATEST_VERSION):
"""
Retrieve the validator class appropriate for validating the given schema.
Uses the :validator:`$schema` property that should be present in the given
schema to look up the appropriate validator class.
Arguments:
schema (collections.Mapping or bool):
the schema to look at
default:
the default to return if the appropriate validator class cannot be
determined.
If unprovided, the default is to return
the latest supported draft.
"""
if schema is True or schema is False or u"$schema" not in schema:
return default
if schema[u"$schema"] not in meta_schemas:
> warn(
(
"The metaschema specified by $schema was not found. "
"Using the latest draft to validate, but this will raise "
"an error in the future."
),
DeprecationWarning,
stacklevel=2,
)
E DeprecationWarning: The metaschema specified by $schema was not found. Using the latest draft to validate, but this will raise an error in the future.
/opt/hostedtoolcache/Python/3.11.4/x64/lib/python3.11/site-packages/jsonschema/validators.py:926: DeprecationWarning