-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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: add webhooks support #1304
Conversation
src/components/SideMenu/MenuItem.tsx
Outdated
@@ -90,7 +90,11 @@ export class OperationMenuItemContent extends React.Component<OperationMenuItemC | |||
deprecated={item.deprecated} | |||
ref={this.ref} | |||
> | |||
<OperationBadge type={item.httpVerb}>{shortenHTTPVerb(item.httpVerb)}</OperationBadge> | |||
{item.isWebhook ? ( | |||
<OperationBadge type="hook">hook</OperationBadge> |
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 wonder why not webhook
?
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.
Check out the screenshot above.webhook
will be wider than the rest badges and will look ugly.
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.
This label/badge needs to be configurable. "hook" is a pejorative word in various vernacular (can mean to cheat or prostitution).
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.
@adamaltman Do you have any other ideas? Maybe whook
or webh
? We use opts
for options
and del
for delete
.
src/services/SpecStore.ts
Outdated
@@ -15,6 +16,7 @@ export class SpecStore { | |||
externalDocs?: OpenAPIExternalDocumentation; | |||
contentItems: ContentItemModel[]; | |||
securitySchemes: SecuritySchemesModel; | |||
'x-webhooks'?: WebhookModel; |
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.
What about xWebhooks
or xWebHooks
?
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.
This is by OpenAPI spec, all vendor extensions should be prefixed by x-
.
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.
Oops, my bad. This is our code not typing for OAS. @stasiukanya could you update it to xWebhooks
? And everywhere else.
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.
Why not webhooks
then if it is our code?
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.
@adamaltman good catch!
src/services/SpecStore.ts
Outdated
@@ -26,5 +28,6 @@ export class SpecStore { | |||
this.externalDocs = this.parser.spec.externalDocs; | |||
this.contentItems = MenuBuilder.buildStructure(this.parser, this.options); | |||
this.securitySchemes = new SecuritySchemesModel(this.parser); | |||
this['x-webhooks'] = new WebhookModel(this.parser, options, this.parser.spec['x-webhooks']); |
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.
this['x-webhooks'] = new WebhookModel(this.parser, options, this.parser.spec['x-webhooks']); | |
this.xWebhooks = new WebhookModel(this.parser, options, this.parser.spec['x-webhooks']); |
🎉 👏 |
Hey @lornajane! We've already released x-webhooks support in the latest 2.0.0-rc.37 and redoc-cli@0.9.11. Could you take a look and let us know what you think? We still haven't announced it, wanted to get your feedback before! |
I love this! The feature looks exactly what I expected (basically callbacks, but in a different context), and feels familiar. I think this is the catalyst I needed to go ahead and start updating our specs within the 3.0 versions to include this, ready for an official OpenAPI 3.1 release! |
This PR implements webhooks support.
Example of usage:
Layout: