Apicurio / apicurio-registry

An API/Schema registry - stores APIs and Schemas.
https://www.apicur.io/registry/
Apache License 2.0
609 stars 269 forks source link

JSON Schema de-referencing missing references in `allOf` #5511

Open EricWittmann opened 4 days ago

EricWittmann commented 4 days ago

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 commented 2 days ago

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?