Skip to content
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

JSON Schema de-referencing missing references in allOf #5511

Closed
EricWittmann opened this issue Nov 12, 2024 · 4 comments · Fixed by #5560
Closed

JSON Schema de-referencing missing references in allOf #5511

EricWittmann opened this issue Nov 12, 2024 · 4 comments · Fixed by #5560

Comments

@EricWittmann
Copy link
Member

Description

Registry
Version
: 2.6.x
Persistence type: All

Environment

Telus eval

Steps to Reproduce

  1. Create JSON schema artifact called specref.json (valid JSON schema, content does not matter)
  2. Create another JSON schema artifact with reference to (1) like so:
{
    "$id": "https://tinaa.telus.com/univ/resourceCatalog/tinaa/v1/ipv4Address.json",
    "$schema": "http://json-schema.org/draft-07/schema#",
    "type": "object",
    "properties": {
        "ipv4Address":  { 
            "type": "string"
        }
    },
    "required": ["ipv4Address"],
    "allOf": [
        {
            "$ref": "https://ext.com/specref.json"
        }
    ]
}

Note the $ref inside the allOf.

  1. Request the content from the artifact in (2) but with dereferencing enabled

The response is:

{
    "message": "Can't resolve 'https://ext.com/specref.json', only internal refs are supported.",
    "error_code": 500,
    "detail": "UnsupportedOperationException: Can't resolve 'https://ext.com/specref.json', only internal refs are supported.",
    "name": "UnsupportedOperationException"
}
@carlesarnal
Copy link
Member

Isn't this expected if the dereferencing is pointing to an schema on the internet? Or are we discussing that the 500 must be handled (with that I do agree). Isn't this working if the $ref points to a reference in Registry?

@EricWittmann
Copy link
Member Author

I believe that a mapping is being provided. When the mapping is provided, and the $ref is not inside an allOf then it works. But if a mapping is provided and the $ref is inside an allOf then it fails. That's my understanding. I haven't tested it yet.

@carlesarnal carlesarnal linked a pull request Nov 21, 2024 that will close this issue
@carlesarnal
Copy link
Member

I have confirmed the problem. References re-writes were not properly handled inside array objects (allof, anyof, oneof etc). I have fixed the problem in the PR I linked.

@carlesarnal carlesarnal moved this from Backlog to Done in Registry 3.0 Nov 21, 2024
@carlesarnal carlesarnal moved this from Done to In Progress in Registry 3.0 Nov 21, 2024
@EricWittmann
Copy link
Member Author

Fixed in:

@github-project-automation github-project-automation bot moved this from In Progress to Done in Registry 3.0 Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants