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
I would expect TSOA to not add a format option to the corresponding type in the openapi.yaml:
numberType:
type: number
Additionally, I do not have the optional defaultNumberType config set in my TSOA config.
Current Behavior
This is the result I will get:
numberType:
type: numberformat: double
The source of this behavior comes from lines 148-150 in packages/cli/src/cli.ts - see this pull request. If you not set defaultNumberType, it will just assume a double type for the numberType. In this context I wanted to get some clarification on why this behavior is the default approach?
For our use case, we would like to just have the type without the optional format. In downstream tasks it would lead to some confusion in the validation as the input 0 will be validated against the type double in the current default behavior. For languages like Python, it would lead to an error with such an input because the 0 is an integer. Removing format: double would lead to a successful validation as only number consists of floating numbers and integers.
Possible Solution
Remove the respective lines.
Steps to Reproduce
Context (Environment)
Version of the library: 6.2.0
Version of NodeJS: 18.18.0
Confirm you were using yarn not npm: [x]
Detailed Description
Breaking change?
The text was updated successfully, but these errors were encountered:
Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
If you have the following property in an interface
I would expect TSOA to not add a format option to the corresponding type in the
openapi.yaml
:Additionally, I do not have the optional
defaultNumberType
config set in my TSOA config.Current Behavior
This is the result I will get:
The source of this behavior comes from lines 148-150 in
packages/cli/src/cli.ts
- see this pull request. If you not setdefaultNumberType
, it will just assume a double type for thenumberType
. In this context I wanted to get some clarification on why this behavior is the default approach?For our use case, we would like to just have the type without the optional format. In downstream tasks it would lead to some confusion in the validation as the input
0
will be validated against the type double in the current default behavior. For languages like Python, it would lead to an error with such an input because the0
is an integer. Removingformat: double
would lead to a successful validation as only number consists of floating numbers and integers.Possible Solution
Remove the respective lines.
Steps to Reproduce
Context (Environment)
Version of the library: 6.2.0
Version of NodeJS: 18.18.0
Detailed Description
Breaking change?
The text was updated successfully, but these errors were encountered: