--check-metaschema doesn't check $ref referenced schemas
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
Research direction
Reproduce the behavior with check-jsonschema --check-metaschema main.json and the supplied main.json, props1.json, and props2.json schemas. Trace how metaschema checking handles the $ref entries, then ensure the recursive check reports the BADstring type in props1.json while preserving the existing successful case for props2.json.
Written by the indexing model from the issue text.
Description
Considering the next json schema definition:
{
"title": "main.json"
"$id": "file://test-schemas/schemas/main.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"type": "object",
"required": [
"metadata"
],
"properties": {
"metadata": {
"additionalProperties": false,
"type": "object",
"required": [
"props1",
"props2"
],
"properties": {
"props1": {
"$ref": "/schemas/props1.json#/props"
},
"props2": {
"$ref": "/schemas/props2.json#/props"
}
}
}
}
}
{
"title": "props1.json"
"$id": "/schemas/props1.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"props": {
"type": "object",
"required": [
"metadata"
],
"properties": {
"metadata": {
"additionalProperties": false,
"type": "object",
"required": [
"name",
"id"
],
"properties": {
"name": {
"type": "BADstring"
},
"id": {
"type": "integer"
}
}
}
}
}
}
{
"title": "props2.json"
"$id": "/schemas/props2.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"props": {
"type": "object",
"required": [
"metadata"
],
"properties": {
"metadata": {
"additionalProperties": false,
"type": "object",
"required": [
"name",
"id"
],
"properties": {
"name": {
"type": "string"
},
"id": {
"type": "integer"
}
}
}
}
}
}
I'd like to be able to check fully recursively the schema main.json but it seems that check-jsonchema --check-metaschema main.json doesn't traverse references.
In this case, props1.json schema contains an error. "type" can't be "BADstring" (according to the metaschema". However, the check of main.json returns an ok -- validation done
Am I doing something wrong, there is a bug, or it is feature that could be proposed for enhancement?
thanks in advance!!
- Dominant language
- Python
- Stars
- 341
- Forks
- 71
- Avg merge
- 6d 13h
- Merged PRs (30d)
- 6
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from python-jsonschema/check-jsonschema
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 48/100
-
enhancement
python-jsonschema/check-jsonschema#668 · 9 comments · 1 assignee ·
-
Difficulty 3/5 1-2 days Newbie friendliness 55/100
-
Difficulty 3/5 1-2 days Newbie friendliness 48/100
python-jsonschema/check-jsonschema#655 · 1 reaction ·
All issues in python-jsonschema/check-jsonschema
Similar issues
-
area: harness bug status: needs-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Human-Agent-Society/reef#625 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
learningequality/kolibri#15351 · 2 comments ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Name consistency Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
eellak/triplestore#65 · 1 comment ·