Using Omit on a type that includes a field that is a string with a regex pattern, tsoa ignores the regex pattern validation, and validates only that the value is a string.
Sorting
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] support request
I confirm that I
[x] used the search to make sure that a similar issue hasn't already been submit
Steps to Reproduce
Given a regex pattern type, e.g. UUID type from the tsoa docs:
/**
* Stringified UUIDv4.
* See [RFC 4112](https://tools.ietf.org/html/rfc4122)
* @pattern [0-9A-Fa-f]{8}-[0-9A-Fa-f]{4}-4[0-9A-Fa-f]{3}-[89ABab][0-9A-Fa-f]{3}-[0-9A-Fa-f]{12}
* @format uuid
*/
type UUID = string;
And types:
type User = {
id: UUID;
omittedField: number;
}
type CreateUser = Omit<User, 'omittedField'>;
Expected Behavior
Using CreateUser as the type of a request body, tsoa should validate that the id field string value matches the regex pattern.
Current Behavior
Using CreateUser on the request body of a request, tsoa only validates that the id field is a string, but does NOT validates the regex pattern.
Context (Environment)
Version of the library: 6.0.1
Version of NodeJS: 16.17.0
Confirm you were using yarn not npm: [ i used npm ]
Using
Omit
on a type that includes a field that is a string with a regex pattern, tsoa ignores the regex pattern validation, and validates only that the value is a string.Sorting
I'm submitting a ...
I confirm that I
Steps to Reproduce
Given a regex pattern type, e.g. UUID type from the tsoa docs:
And types:
Expected Behavior
Using
CreateUser
as the type of a request body, tsoa should validate that theid
field string value matches the regex pattern.Current Behavior
Using
CreateUser
on the request body of a request, tsoa only validates that theid
field is a string, but does NOT validates the regex pattern.Context (Environment)
Version of the library: 6.0.1 Version of NodeJS: 16.17.0