-
Notifications
You must be signed in to change notification settings - Fork 11
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: callback operation ids #262
Conversation
src/oas/operation.ts
Outdated
@@ -89,6 +89,7 @@ export const transformOasEndpointOperation: TranslateFunction< | |||
parentId: serviceId, | |||
method, | |||
path: name, | |||
key: key ?? 'unknown', |
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.
Or should we generate random string in that case?
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.
i think it would have to be something stable. i'm kind of thinking this should throw but @P0lip might have a suggestion
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.
You can leave an empty key key ?? ''
. That's what we do for schemas
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.
Updated
@@ -36,6 +36,7 @@ export interface ITransformEndpointOperationOpts<T extends Fragment> { | |||
document: T; | |||
name: string; | |||
method: string; | |||
key?: 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.
Needed because transformOas3Operation
uses this type
src/generators.ts
Outdated
httpCallbackOperation: (props: Context & { method: string; path: string }) => { | ||
return join(['http_callback', props.parentId, props.method, props.path]); | ||
httpCallbackOperation: (props: Context & { method: string; path: string; key: string }) => { | ||
return join(['http_callback', props.parentId, props.method, props.path, props.key]); |
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.
lets flip this around so that its between parent and method
🎉 This PR is included in version 7.0.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Addresses: https://github.com/stoplightio/platform-internal/issues/18498
Motivation and Context
Callback ids are currently being generated based on operation method and path. This may lead to duplicated ids in case where one operation has more than one callbacks defined.
Description
Adds additional key property (callback name) when generating ids for callback nodes.
How Has This Been Tested?
Tests updated
Screenshot(s)/recordings(s)
Types of changes
Checklist