kit-data-manager / kit-data-manager/metastore2

Uploading JSONSchema with $ref fails

Open
#34 1 comment 0 reactions 0 assignees View on GitHub
discussion
Dominant language
Java
Stars
8
Forks
11
PR merge metrics
No merged PRs in 30d

Description

When I upload a schema with a property using `$ref`, I get the error `java.io.FileNotFoundException: http://example.org/abc`.
I would expect that the validator does not resolve this URL and only checks if the schema is valid against the metaschema.

Example:
```json
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$id": "http://example.org/idontcare",
"title": "Doesntmatter",
"type": "object",
"properties": {
"abc": {
"$ref": "http://example.org/abc"
}
}
}
```

Hint: I think the problem is that in `JsonUtils::validateJsonSchemaDocument` the same validation method is used as validating a document against a schema which requires resolving the URL.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at JsonUtils::validateJsonSchemaDocument and compare how schema documents are validated with document-against-schema validation. Use the provided schema containing a remote $ref to reproduce the FileNotFoundException, then verify that schema validation checks the metaschema without resolving that referenced URL.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.