-
Notifications
You must be signed in to change notification settings - Fork 61
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
fix(libs+sessions): Add 202 response code handling to document decorator. #15187
Conversation
WalkthroughThe changes in Changes
Sequence Diagram(s)sequenceDiagram
participant Client
participant Server
participant SwaggerDecorator
Client->>Server: Send request
Server->>SwaggerDecorator: getResponseDecorators(status: 202)
SwaggerDecorator-->>Server: ApiAcceptedResponse(response)
Server-->>Client: Respond with status 202
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #15187 +/- ##
=======================================
Coverage 37.01% 37.01%
=======================================
Files 6423 6423
Lines 131041 131043 +2
Branches 37523 37524 +1
=======================================
+ Hits 48511 48512 +1
- Misses 82530 82531 +1
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Sentry.
|
Datadog ReportAll test runs ✅ 5 Total Test Services: 0 Failed, 5 Passed Test Services
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
Outside diff range and nitpick comments (2)
libs/nest/swagger/src/lib/documentation.decorator.ts (2)
Line range hint
88-88
: Optimize the use of spread syntax in accumulators to improve performance.- const paramsDecorators = paramsKeys.reduce( - (acc, name) => [...acc, ApiParam({ name, ...params[name] })], - defaultValue, - ) + const paramsDecorators = paramsKeys.reduce((acc, name) => { + acc.push(ApiParam({ name, ...params[name] })); + return acc; + }, defaultValue);
Line range hint
25-25
: Specify a more precise type instead ofany
to enhance type safety.- function getResponseDecorators(statusCode: number, response: any) { + function getResponseDecorators(statusCode: number, response: ApiResponseMetadata) {
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files selected for processing (1)
- libs/nest/swagger/src/lib/documentation.decorator.ts (2 hunks)
Additional context used
Path-based instructions (1)
libs/nest/swagger/src/lib/documentation.decorator.ts (1)
Pattern
libs/**/*
: "Confirm that the code adheres to the following:
- Reusability of components and hooks across different NextJS apps.
- TypeScript usage for defining props and exporting types.
- Effective tree-shaking and bundling practices."
Biome
libs/nest/swagger/src/lib/documentation.decorator.ts
[error] 88-88: Avoid the use of spread (
...
) syntax on accumulators. (lint/performance/noAccumulatingSpread)Spread syntax should be avoided on accumulators (like those in
.reduce
) because it causes a time complexity ofO(n^2)
.
Consider methods such as .splice or .push instead.
GitHub Check: linting (nest-swagger)
libs/nest/swagger/src/lib/documentation.decorator.ts
[warning] 25-25:
Unexpected any. Specify a different type
…tor. (#15187) Co-authored-by: Valur Einarsson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
…tor. (#15187) Co-authored-by: Valur Einarsson <[email protected]> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
What
Add 202 to possible response codes in openapi generation.
Why
So codegen works for services with 202 status code.
Screenshots / Gifs
Attach Screenshots / Gifs to help reviewers understand the scope of the pull request
Checklist:
Summary by CodeRabbit