Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(common): add parse float and enum pipes #6232

Merged
merged 2 commits into from
Feb 2, 2021
Merged

feat(common): add parse float and enum pipes #6232

merged 2 commits into from
Feb 2, 2021

Conversation

kaufmo
Copy link
Contributor

@kaufmo kaufmo commented Jan 25, 2021

PR Checklist

Please check if your PR fulfills the following requirements:

PR Type

What kind of change does this PR introduce?

[ ] Bugfix
[x] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Other... Please describe:

What is the current behavior?

Added two new pipe transformers for float and enum values

Issue Number: N/A

What is the new behavior?

It is possible now to use new pipe transformer for float values and enum values

Does this PR introduce a breaking change?

[ ] Yes
[x] No

Other information

@kaufmo kaufmo changed the title Add parse float and enum pipes feat(chore): add parse float and enum pipes Jan 25, 2021
@kaufmo kaufmo changed the title feat(chore): add parse float and enum pipes feat(common): add parse float and enum pipes Jan 25, 2021
@coveralls
Copy link

coveralls commented Jan 25, 2021

Pull Request Test Coverage Report for Build 9a9ded65-2426-4dc3-9bbe-6c14cb01e97a

  • 24 of 26 (92.31%) changed or added relevant lines in 3 files are covered.
  • 9 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.01%) to 94.729%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/common/pipes/parse-enum.pipe.ts 12 13 92.31%
packages/common/pipes/parse-float.pipe.ts 10 11 90.91%
Files with Coverage Reduction New Missed Lines %
packages/microservices/context/rpc-context-creator.ts 2 95.19%
packages/websockets/context/ws-context-creator.ts 2 95.05%
packages/core/helpers/external-context-creator.ts 5 90.57%
Totals Coverage Status
Change from base Build dc31867d-4641-4462-b640-88e523413104: -0.01%
Covered Lines: 5104
Relevant Lines: 5388

💛 - Coveralls

* @param metadata contains metadata about the currently processed route argument
*/
async transform(value: T, metadata: ArgumentMetadata): Promise<T> {
if (!classValidator.isEnum(value, this.enumType)) {
Copy link
Member

Choose a reason for hiding this comment

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

Can we manually implement the isEnum method logic and add it to this class instead of relying on class-validator here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes I wasn't even happy with that, I'll change this 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@kamilmysliwiec I've updated the check now

@kamilmysliwiec kamilmysliwiec added this to the 8.0.0 milestone Feb 2, 2021
@kamilmysliwiec kamilmysliwiec changed the base branch from master to 8.0.0 February 2, 2021 09:01
@kamilmysliwiec
Copy link
Member

LGTM thanks!

@kamilmysliwiec kamilmysliwiec merged commit 9faeab9 into nestjs:8.0.0 Feb 2, 2021
@kaufmo kaufmo deleted the add-parse-float-and-enum-pipes branch February 2, 2021 10:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants