Skip to content

Commit b551b04

Browse files
p1-alexandrevaneyp1-ra
authored andcommitted
dont use resolved schema in collision resolver
1 parent f2a1d15 commit b551b04

File tree

1 file changed

+23
-18
lines changed

1 file changed

+23
-18
lines changed

tests/test_resolver/test_resolver_collision_resolver.py

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
def test__collision_resolver():
99

1010
from openapi_python_client.resolver.collision_resolver import CollisionResolver
11-
from openapi_python_client.resolver.resolved_schema import ResolvedSchema
1211

1312
root_schema = {
1413
"foobar": {"$ref": "first_instance.yaml#/foo"},
@@ -34,28 +33,34 @@ def test__collision_resolver():
3433
"/home/user/fifth_instance.yaml": {"foo": {"description": "foo_second_description"}},
3534
}
3635

37-
desired_result = {
38-
"foobar": {"$ref": "#/foo"},
39-
"barfoo": {"$ref": "#/foo_2"},
40-
"baz": {"$ref": "#/foo_2"},
41-
"barbarfoo": {"$ref": "#/foo_3"},
42-
"foobarfoo": {"$ref": "#/foo_2"},
43-
"barfoobar": {"$ref": "#/bar/foo"},
36+
root_schema_result = {
37+
"foobar": {"$ref": "first_instance.yaml#/foo"},
38+
"barfoo": {"$ref": "second_instance.yaml#/foo_2"},
39+
"barbarfoo": {"$ref": "third_instance.yaml#/foo_3"},
40+
"foobarfoo": {"$ref": "second_instance.yaml#/foo_2"},
41+
"barfoobar": {"$ref": "first_instance.yaml#/bar/foo"},
4442
"localref": {"$ref": "#/local_ref"},
4543
"local_ref": {"description": "a local ref"},
46-
"last": {"$ref": "#/fourth_instance"},
47-
"foo": {"description": "foo_first_description"},
48-
"foo_2": {"description": "foo_second_description"},
49-
"foo_3": {"description": "foo_third_description"},
50-
"bar": {"foo": {"description": "nested foo"}},
51-
"foo_4": {"description": "foo_fourth_description"},
52-
"fourth_instance": {"$ref": "#/foo_4"},
44+
"last": {"$ref": "first_instance.yaml#/fourth_instance"},
45+
"baz": {"$ref": "fifth_instance.yaml#/foo_2"},
46+
}
47+
48+
external_schemas_result = {
49+
"/home/user/first_instance.yaml": {
50+
"foo": {"description": "foo_first_description"},
51+
"bar": {"foo": {"description": "nested foo"}},
52+
"fourth_instance": {"$ref": "fourth_instance.yaml#/foo_4"},
53+
},
54+
"/home/user/second_instance.yaml": {"foo_2": {"description": "foo_second_description"}},
55+
"/home/user/third_instance.yaml": {"foo_3": {"description": "foo_third_description"}},
56+
"/home/user/fourth_instance.yaml": {"foo_4": {"description": "foo_fourth_description"}},
57+
"/home/user/fifth_instance.yaml": {"foo_2": {"description": "foo_second_description"}},
5358
}
59+
5460
errors = []
5561

5662
CollisionResolver(root_schema, external_schemas, errors, "/home/user").resolve()
57-
resolved_schema = ResolvedSchema(root_schema, external_schemas, errors, "/home/user").schema
5863

59-
print(resolved_schema)
6064
assert len(errors) == 0
61-
assert resolved_schema == desired_result
65+
assert root_schema == root_schema_result
66+
assert external_schemas == external_schemas_result

0 commit comments

Comments
 (0)