-
-
Notifications
You must be signed in to change notification settings - Fork 119
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: pass the Operation object to methodNameBuilder #696
feat: pass the Operation object to methodNameBuilder #696
Conversation
Run & review this pull request in StackBlitz Codeflow. |
🦋 Changeset detectedLatest commit: 4efe4a3 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
* Customise the method name of methods within the service | ||
*/ | ||
methodNameBuilder?: (service: string, operationId: string) => string; | ||
* Customise the method name of methods within the service. By default, operationName is used. | ||
*/ | ||
methodNameBuilder?: ( | ||
service: string, | ||
/** | ||
* Method name used by default. | ||
*/ | ||
operationName: string, | ||
/** | ||
* The operationId from OpenAPI specification. | ||
*/ | ||
operationId: string | null, | ||
) => string; |
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.
If possible, I would like to pass an object to the methodNameBuilder, but for backward compatibility, I have added an additional argument.
I think this is the ideal style:
methodNameBuilder?: (
service: string,
operation: {
name: string,
id: string | null,
}
) => string;
or
methodNameBuilder?: (
args: {
service: string,
operationName: string,
operationId: string | null,
}
) => string;
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.
Can you pass a single operation object here? We'll write migration notes, it's not hard to migrate
@@ -42,6 +42,7 @@ export const getOperation = ({ | |||
deprecated: op.deprecated === true, | |||
description: op.description || null, | |||
errors: [], | |||
id: op.operationId || null, |
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.
Added id property to Operation
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.
Let's pass a whole object!
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.
Yup, nice one! I'll need to write migration docs separately
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #696 +/- ##
==========================================
+ Coverage 70.89% 74.23% +3.33%
==========================================
Files 76 76
Lines 7984 7990 +6
Branches 696 752 +56
==========================================
+ Hits 5660 5931 +271
+ Misses 2321 2056 -265
Partials 3 3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Closes #695