Open
Description
The functionality that a property with a set default
value is treated as required or non-optional does not work when defining the set property via a reference.
For example,
Currently a schema defined like:
{
type: "object",
properties: {
value: { type: "number", default: 5 },
},
additionalProperties: false,
}
results in this type:
{
value: number
}
However, when defining via reference, this functionality does not work.
{
type: "object",
definitions: {
Value: { type: "number", default: 5 },
}
properties: {
value: { $ref: '#/definitions/Value' },
},
additionalProperties: false,
}
Resolves to type
{
value?: number | undefined
}
I believe this is unwanted behaviour but please feel free to correct me with my usage.
Metadata
Metadata
Assignees
Labels
No labels