You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After updating TSOA from version 6.0.0 to 6.2.0, we encountered a validation error when attempting to PATCH properties that were previously defined using TypeScript utility types (e.g., Partial, Pick) and are explicitly allowed to be null (defined as number | null). We resolved this issue by changing the type definitions to explicitly define each property without embedded utility types, but it raises concerns about TSOA's handling of such TypeScript constructs in the latest version.
To Reproduce:
Steps to reproduce the behavior:
Original type definition using embedded utility types:
Set up a TSOA route to update this entity, using a PATCH method:
@Patch()
@Body() body: aBodyUpdateArgsType[],
...
Launch a server API and:
Attempt to PATCH the aProperty1 property with a value of null : it works
Attempt to PATCH the aProperty3 property with a value of null : Validation Failed with the following error:
{
"message": "Validation Failed",
"details": [
"Field \"body.$0.aProperty3\" has invalid value: Could not match the intersection against every type. Issues: [{\"body.$0.aProperty3\":{\"message\":\"invalid float number\",\"value\":null}}]"
]
}
Changing the type definitions to explicitly define each field, as shown below, resolves the issue:
This issue is particularly concerning because it affects our ability to use TypeScript utility types effectively with TSOA, limiting our approach to defining flexible and maintainable APIs. It also suggests a potential regression or change in how TSOA handles TypeScript type resolution in its latest version? 🤔
The text was updated successfully, but these errors were encountered:
Description:
After updating TSOA from version 6.0.0 to 6.2.0, we encountered a validation error when attempting to PATCH properties that were previously defined using TypeScript utility types (e.g., Partial, Pick) and are explicitly allowed to be null (defined as number | null). We resolved this issue by changing the type definitions to explicitly define each property without embedded utility types, but it raises concerns about TSOA's handling of such TypeScript constructs in the latest version.
To Reproduce:
Steps to reproduce the behavior:
Original type definition using embedded utility types:
anEntity
with the columns:Attempt to PATCH the
aProperty1
property with a value of null : it worksAttempt to PATCH the
aProperty3
property with a value of null :Validation Failed
with the following error:Additional Context:
This issue is particularly concerning because it affects our ability to use TypeScript utility types effectively with TSOA, limiting our approach to defining flexible and maintainable APIs. It also suggests a potential regression or change in how TSOA handles TypeScript type resolution in its latest version? 🤔
The text was updated successfully, but these errors were encountered: