Skip to content

Feature/validation decorators#46

Open
memicmiralem wants to merge 13 commits into
kimjbstar:mainfrom
reiprintmail:feature/validation-decorators
Open

Feature/validation decorators#46
memicmiralem wants to merge 13 commits into
kimjbstar:mainfrom
reiprintmail:feature/validation-decorators

Conversation

@memicmiralem
Copy link
Copy Markdown

Fixes #45

Proposed Changes

  • adds new flag useValidation: boolean (default = false)
  • if the flag is true then validation decorators are generated similar to swagger decorators

Comment thread src/convertor.ts
Comment on lines +256 to +264
case 'Int':
decoratorArgs.name = 'IsInt'
break
case 'BigInt':
decoratorArgs.name = 'IsInt'
break
case 'SmallInt':
decoratorArgs.name = 'IsInt'
break
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
case 'Int':
decoratorArgs.name = 'IsInt'
break
case 'BigInt':
decoratorArgs.name = 'IsInt'
break
case 'SmallInt':
decoratorArgs.name = 'IsInt'
break
case 'Int':
case 'BigInt':
case 'SmallInt':
decoratorArgs.name = 'IsInt'
break

you could use use a fall-through here, making it easier to read. Otherwise a fixed map at the top of the file would also be better to not have this huge switch-case here, have a look at the primitiveMapType variable

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: generate validation decorators

2 participants