Skip to content

Commit

Permalink
bug fix for undiscriminated union and optional implying nullable
Browse files Browse the repository at this point in the history
  • Loading branch information
dsinghvi committed Oct 21, 2024
1 parent bfc7aa0 commit d8b4703
Show file tree
Hide file tree
Showing 224 changed files with 7,135 additions and 1,080 deletions.
9 changes: 9 additions & 0 deletions packages/cli/cli/versions.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
- changelogEntry:
- changelogEntry:
- summary: |
Undiscriminated unions are now represented using `anyOf` in the generated JSON Schema
Nullable properties are now correctly propagated to the JSON Schema
type: fix
irVersion: 53
version: 0.45.0-rc12

- changelogEntry:
- summary: |
Improved JSON Schema generation for object inheritance:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,14 @@
"type": "integer"
},
"refresh_token": {
"type": "string"
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-b.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-b.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand All @@ -24,7 +31,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-c.common.FolderCFoo"
"oneOf": [
{
"$ref": "#/definitions/folder-c.common.FolderCFoo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-c.common.FolderCFoo"
"oneOf": [
{
"$ref": "#/definitions/folder-c.common.FolderCFoo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"public_property": {
"type": "string"
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
]
},
"private_property": {
"type": "integer"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"definitions": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"a": {
"$ref": "#/definitions/a.A"
"oneOf": [
{
"$ref": "#/definitions/a.A"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down Expand Up @@ -88,7 +95,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"a": {
"$ref": "#/definitions/a.A"
"oneOf": [
{
"$ref": "#/definitions/a.A"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down Expand Up @@ -88,7 +95,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,14 @@
"const": "optional"
},
"value": {
"$ref": "#/definitions/ast.FieldValue"
"oneOf": [
{
"$ref": "#/definitions/ast.FieldValue"
},
{
"type": "null"
}
]
}
},
"required": [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"oneOf": [
"anyOf": [
{
"type": "array",
"items": {
Expand All @@ -24,7 +24,7 @@
],
"definitions": {
"ast.JsonLike": {
"oneOf": [
"anyOf": [
{
"type": "array",
"items": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-b.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-b.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand All @@ -24,7 +31,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-c.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-c.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-c.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-c.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-b.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-b.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false,
Expand All @@ -24,7 +31,14 @@
"type": "object",
"properties": {
"foo": {
"$ref": "#/definitions/folder-c.common.Foo"
"oneOf": [
{
"$ref": "#/definitions/folder-c.common.Foo"
},
{
"type": "null"
}
]
}
},
"additionalProperties": false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
{
"type": "string",
"oneOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"definitions": {}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/Color"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
]
},
"Type": {
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/BasicType"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"oneOf": [
"anyOf": [
{
"$ref": "#/definitions/BasicType"
},
Expand Down
Loading

0 comments on commit d8b4703

Please sign in to comment.