Provide a helper to fully resolve $refs in a schema
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- json, python
- Domain
- api, backend-api-design
Research direction
Start by reviewing the referencing repository's existing API and the example schema in this issue. A complete result would provide a way to traverse the schema with internal $refs inlined while avoiding infinite expansion from self-references.
Written by the indexing model from the issue text.
Description
I want to generate some documentation/description (probably some input forms) from a json schema that contains $refs. Is there a way in jsonschema to retrieve a json schema with $refs resolved and inlined, so I can iterate through the schema?
So from a schema like this:
{
"definitions": {
"some_object": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
},
"properties": {
"list_of_objects": {
"type": "array",
"title": "Some stuff",
"description": "List of stuff",
"items": {"$ref": "#/definitions/some_object"}
}
}
}
I want to have this structure in my Python object (notice that the {$ref:...} section is replaced by the actual definition):
{
"definitions": {
"some_object": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
},
"properties": {
"list_of_objects": {
"type": "array",
"title": "Some stuff",
"description": "List of stuff",
"items": {
"type": "object",
"title": "My definition",
"description": "Some description",
"properties": {
"name": {
"type": "string"
},
"value": {
"type": "number"
}
}
}
}
}
}
I am aware that with self-referencing schemas this will lead to an infinite structure, but hopefully this is feasible with reasonable limitations (eg. excluding self-refs).
- Dominant language
- Python
- Stars
- 56
- Forks
- 55
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 4
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
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/referencing
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
python-jsonschema/referencing#444 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
python-jsonschema/referencing#434 ·
-
$ref resolution in a $dynamicRef target ($dynamicAnchor) happening from base URI instead of targetOpen
Difficulty 4/5 3-5 days Newbie friendliness 30/100
python-jsonschema/referencing#445 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 52/100
python-jsonschema/referencing#442 ·
-
$dynamicRef doesn't find $dynamicAnchor overrides in root schemas without $idPossibly taken @aqeelat claimed this 174 days ago. Open
Difficulty 4/5 3-5 days Newbie friendliness 45/100
python-jsonschema/referencing#366 ·
All issues in python-jsonschema/referencing
Similar issues
-
accepted
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
future-agi/future-agi#5908 ·
Maintainers usually reply within 1 day
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
eclipse-score/coverage_tool#101 ·
Maintainers usually reply within 2 days
-
Placeholder export disables HTML image input for picture descriptionPossibly taken @cloudiful claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
docling-project/docling-serve#817 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 92/100
Techiebutler/freeframe#687 ·
Maintainers usually reply within 1 day
-
Parse truncated verbose GC logs up to the first XML errorPossibly taken A pull request linked to this issue is open or already merged. Openbug verbose GC
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
IBM/javacore-analyser#677 ·
Maintainers usually reply within 1 day