Skip to content

A $ref may be a property name and in such cases it's not hashable #124

New issue

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

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

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion openapi_spec_validator/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ def __init__(self, instance_resolver):

def __call__(self, func):
def wrapped(validator, schema_element, instance, schema):
if not isinstance(instance, dict) or '$ref' not in instance:
if (not isinstance(instance, dict) or '$ref' not in instance
or not instance['$ref'].__hash__):
for res in func(validator, schema_element, instance, schema):
yield res
return
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/data/v3.0/petstore.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ components:
type: string
tag:
type: string
$ref:
type: string
Pets:
type: array
items:
Expand Down