danielgtaylor / danielgtaylor/aglio

"One of" is incorrectly translated to merged object schema in JSON Schema and loses required field information

Open
#301 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
CoffeeScript
Stars
4.7k
Forks
471
PR merge metrics
No merged PRs in 30d

Description

An array[NodeData], where NodeDate is defined as:

```
## NoteData (fixed-type)
+ One of
+ Properties
+ id: 1 (required, number) - Unique identifier
+ title: Grocery list (required) - Single line description
+ body: Buy milk - Full description of the note which supports Markdown.
+ Properties
+ id: 1 (required, number) - Unique identifier
+ title: Grocery list (required) - Single line description
+ body: Buy milk - Full description of the note which supports Markdown.
+ other: Other stuff (required)
```

produces, in the JSON schema:

```
{
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "number",
"description": "Unique identifier"
},
"title": {
"type": "string",
"description": "Single line description"
},
"body": {
"type": "string",
"description": "Full description of the note which supports Markdown."
},
"other": {
"type": "string"
}
},
"allOf": [
{
"not": {
"required": [
"id",
"title",
"body",
"id",
"title",
"body",
"other"
]
}
}
]
},
"$schema": "http://json-schema.org/draft-04/schema#"
}
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reproducing the JSON Schema conversion using the array[NodeData] example in the issue and compare the generated schema with the two intended object alternatives. Trace the conversion entry point for fixed-type "One of" blocks, then verify that the result preserves separate alternatives and each alternative's required fields.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.