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
[Bug]: External reference not working properly #565
Labels
kind/bug
Indicates an issue
Comments
It works when I use the path to client_api like an external reference (for an internal reference) as if it was from mobile_api How can I make jsonschema find internal references from both schemas? |
I can confirm that I'm seeing the same issue |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Actual Behavior
I have a schema called mobile_api.json, containing an external reference to another schema called client_api.json, the external reference works, but the client_api.json schema also contain an internal reference, which the resolver doesn't find, are you aware of a solution for this?
stack trace:
\"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/shortcuts.py\", line 173, in unmarshal_request\n return unmarshal_apicall_request(\n ^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/shortcuts.py\", line 116, in unmarshal_apicall_request\n result = v.unmarshal(request)\n ^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/unmarshalling/request/unmarshallers.py\", line 243, in unmarshal\n return self._unmarshal(request, operation, path)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/unmarshalling/request/unmarshallers.py\", line 154, in _unmarshal\n body = self._get_body(request.body, request.mimetype, operation)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/validation/decorators.py\", line 31, in wrapper\n return f(*args, **kwds)\n ^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/validation/request/validators.py\", line 253, in _get_body\n return self._get_content_value(raw_body, mimetype, content)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/unmarshalling/unmarshallers.py\", line 113, in _get_content_value\n return self._unmarshal_schema(schema, casted)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/unmarshalling/unmarshallers.py\", line 90, in _unmarshal_schema\n return unmarshaller.unmarshal(value)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/unmarshalling/schemas/unmarshallers.py\", line 288, in unmarshal\n self.schema_validator.validate(value)\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/openapi_core/validation/schemas/validators.py\", line 38, in validate\n errors = tuple(errors_iter)\n ^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 288, in iter_errors\n for error in errors:\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/_validators.py\", line 332, in properties\n yield from validator.descend(\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 305, in descend\n for error in self.evolve(schema=schema).iter_errors(instance):\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 288, in iter_errors\n for error in errors:\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/_validators.py\", line 294, in ref\n scope, resolved = validator.resolver.resolve(ref)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 898, in resolve\n return url, self._remote_cache(url)\n ^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 916, in resolve_from_url\n return self.resolve_fragment(document, fragment)\n ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n File \"/Users/jonathan/snowfall/junction/dist/export/python/virtualenvs/python-default/3.11.1/lib/python3.11/site-packages/jsonschema/validators.py\", line 968, in resolve_fragment\n raise exceptions.RefResolutionError(\njsonschema.exceptions.RefResolutionError: Unresolvable JSON pointer: 'components/schemas/TripCandidateSearch'"}
Expected Behavior
Find the internal reference in the external referenced schema.
Steps to Reproduce
example mobile_api.json reference:
client_api.json:
OpenAPI Core Version
0.17.1
OpenAPI Core Integration
starlette
Affected Area(s)
schema, unmarshalling
References
No response
Anything else we need to know?
No response
Would you like to implement a fix?
Yes
The text was updated successfully, but these errors were encountered: