Closed
Description
We have an OpenAPI schema where we combine allOf
with required
in the way that we enforce some attributes defined by allOf
to be required, something along these lines:
SomeEntity:
required:
- name
allOf:
- "$ref": "#/definitions/l10nName"
- ...something else...
In this case name
is defined in l10nName
subschema and we enforce it to be required for SomeEntity
. The generated code, however, does not take that into account, generating code with name
property being optional.
This is something that still could be expressed via TypeScript as something like:
SomeEntity_raw: <whatever definition is being generated right now>,
SomeEntity: SomeEntity_raw & Required<Pick<SomeEntity_raw, "name">>,
What do you think? It seems to be relatively simple to detect with something like "if property is in required, but not explicitly defined in properties
on current type, generate enforcing wrapper"
Metadata
Metadata
Assignees
Labels
No labels