@Matches decorator regexp prevent the bootstrapping of swagger
Is there an existing issue for this?
- [X] I have searched the existing issues
Current behavior
Hey Guys 👋
First thanks for your work on the project which until now did not make me need to report an issue ;)
Since the last update, my project cannot run as the bootstrapping of swagger crash thus preventing my API to launch.
After a lil' debugging, the issue seems to come from jsyaml which does not accept RegExp expression while proceeding to the dump
Minimum reproduction code
https://github.com/klemele/nest-debug
Steps to reproduce
yarn
yarn start
Should crash following error:
/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:868
throw new YAMLException('unacceptable kind of an object to dump ' + type);
^
YAMLException: unacceptable kind of an object to dump [object RegExp]
at writeNode (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:868:13)
at writeBlockMapping (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:731:10)
at writeNode (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:834:9)
at writeBlockMapping (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:731:10)
at writeNode (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:834:9)
at writeBlockMapping (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:731:10)
at writeNode (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:834:9)
at writeBlockMapping (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:731:10)
at writeNode (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:834:9)
at writeBlockMapping (/Users/NestUser/repositories/nest-debug/node_modules/js-yaml/lib/dumper.js:731:10)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Simply remove @Matches instruction in the DTO to make it work
Expected behavior
Application and Swagger running correctly with the decorator @Matches
Package version
6.0.3
NestJS version
9.0.1
Node.js version
16.14.2
In which operating systems have you tested?
- [X] macOS
- [ ] Windows
- [ ] Linux
Other
The project use the Swagger CLI option and rely on Fastify rather than Express
https://github.com/nestjs/swagger/issues/1979