Skip to content

Commit 5a326ed

Browse files
authored
Merge pull request #124 from arcivanov/issue_123
A `$ref` may be a property name and in such cases it's not hashable
2 parents 327a4c1 + aec9ad2 commit 5a326ed

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

openapi_spec_validator/decorators.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@ def __init__(self, instance_resolver):
1818

1919
def __call__(self, func):
2020
def wrapped(validator, schema_element, instance, schema):
21-
if not isinstance(instance, dict) or '$ref' not in instance:
21+
if (not isinstance(instance, dict) or '$ref' not in instance
22+
or not instance['$ref'].__hash__):
2223
for res in func(validator, schema_element, instance, schema):
2324
yield res
2425
return

tests/integration/data/v3.0/petstore.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ components:
9393
type: string
9494
tag:
9595
type: string
96+
$ref:
97+
type: string
9698
Pets:
9799
type: array
98100
items:

0 commit comments

Comments
 (0)