zenstack
zenstack copied to clipboard
[Feature Request] Mark nonnullable attributes as required in RESTApiHandler get requests
When using the RESTApiHandler and OpenAPI plugin, the return types for attributes in a get request are currently all optional (<type> | undefined). Since JSON:API responses always include all the attributes, they should not be marked as optional. This can be achieved with listing the attributes in a required array in the openapi schema.
Basically what we want is for the attributes to go from e.g.
Before
{
myString: string | undefined
myNullableString: string | null | undefined
}
After
{
myString: string
myNullableString: string | null
}
See Discord discussion for more details.
This change does not apply to RPCApiHandler since it allows selecting which attributes to return, so they're all optional in practice.