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 upgraded tsoa from v5.1.1 to v6.0.0 in my project. After that a POST endpoint does not evaluate a (nested) @pattern validation annotation anymore and just passes the request to the controller.
Sorting
I'm submitting a ...
bug report
feature request
support request
I confirm that I
used the search to make sure that a similar issue hasn't already been submit
Expected Behavior
Given the following CreateParticipantRequestDto interface and docs for the request body, I expect tsoa to reject any request which does not contain a valid pseudonym value:
/** * The pseudonym is the unique identifier of a participant. * * @pattern ^[a-z]+-[0-9]+$ The pseudonym is only allowed to consist of lower case characters * @example "abcd-1234" */exporttypePseudonym=string;exportinterfaceParticipantDto{pseudonym: Pseudonym;study: string;studyCenter: string|null;/** * The optional examination wave in which the participant participates. * * @isInt */examinationWave: number|null;}exporttypeCreateParticipantRequestDto=Partial<Pick<ParticipantDto,|'pseudonym'|'studyCenter'|'examinationWave'>>;
@gcv-epalmer Thanks for your quick response. Yes, you are right. When I turn CreateParticipantRequestDto into a usual interface, everything works as expected. However, this is something we don't want to do. A fix would be great :)
@WoH I would like to. However, I do not have any glue of the codebase. Also I don't know what changed from v5.1.1 to v6.0.0. I currently don't have the time to familiarise myself with it :/
I upgraded tsoa from v5.1.1 to v6.0.0 in my project. After that a POST endpoint does not evaluate a (nested)
@pattern
validation annotation anymore and just passes the request to the controller.Sorting
I'm submitting a ...
I confirm that I
Expected Behavior
Given the following
CreateParticipantRequestDto
interface and docs for the request body, I expect tsoa to reject any request which does not contain a validpseudonym
value:Controller method:
If I send this request body, I expect tsoa to reject the request because the
pseudonym
does not match the@pattern
regex.Current Behavior
The
@pattern
validation does not lead to a rejected request if the body is invalid.However, the
@isInt
validation in the above example does work as expected.Possible Solution
Steps to Reproduce
see code snippets above
Context (Environment)
Version of the library: 6.0.0
Version of NodeJS: v20.3.0
Detailed Description
Breaking change?
The text was updated successfully, but these errors were encountered: