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

Draft 7 with errors #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open

Conversation

ar45
Copy link

@ar45 ar45 commented Aug 3, 2022

This allows one to use and resolve ids in json schema

SELECT json_schema_resolve_refs('{
                "$id": "http://localhost:1234/root",
                "allOf": [{
                    "$ref": "http://localhost:1234/nested.json#foo"
                }],
                "definitions": {
                    "A": {
                        "$id": "nested.json",
                        "definitions": {
                            "B": {
                                "$id": "#foo",
                                "type": "integer"
                            }
                        }
                    }
                }
            }'
     );

Resolves to

{
  "$id": "http://localhost:1234/root",
  "allOf": [
    {
      "$ref": "http://localhost:1234/nested.json#foo",
      "$_resolvedRef": [
        "definitions",
        "A",
        "definitions",
        "B"
      ]
    }
  ],
  "definitions": {
    "A": {
      "$id": "nested.json",
      "definitions": {
        "B": {
          "$id": "#foo",
          "type": "integer"
        }
      }
    }
  }
}
SELECT validate_json_schema(
    json_schema_resolve_refs('{
                "$id": "http://localhost:1234/root",
                "allOf": [{
                    "$ref": "http://localhost:1234/nested.json#foo"
                }],
                "definitions": {
                    "A": {
                        "$id": "nested.json",
                        "definitions": {
                            "B": {
                                "$id": "#foo",
                                "type": "integer"
                            }
                        }
                    }
                }
            }'
     )
);

@ar45 ar45 mentioned this pull request Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant