Path resolution error in oneOf with $ref when meeting specific conditions
- Dominant language
- JavaScript
- Stars
- 724
- Forks
- 150
- Avg merge
- 18h 22m
- Merged PRs (30d)
- 4
Description
When parsing a JSON Schema with the following structure:
1. A top-level property
2. Using oneOf keyword
3. Containing a $ref reference inside oneOf
The reference resolution fails with 404 error, while other oneOf cases without these conditions work correctly.
```JSON
{
"$id": "/",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"$defs": {
"sampleDefinition": {
"type": "object",
"properties": {
"sampleField": {
"type": "string"
}
}
}
},
"properties": {
"problematicProperty": {
"oneOf": [
{
"$ref": "#/$defs/sampleDefinition"
},
{
"type": "object",
"properties": {}
}
]
}
},
"required": [
"problematicProperty"
]
}
```
- Library version: 8.0.7
- nodejs version: v20.11.1
Thanks for your work on this library! Looking forward to your feedback.
Contributor guide
Research direction
Start by reproducing the reported 404 with the JSON Schema example on jsonschema2md 8.0.7 under Node.js v20.11.1, focusing on path resolution for a $ref nested in oneOf under a top-level property. No source file or test is named in the issue; done means the reference resolves successfully without a 404 while other oneOf cases remain working.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100