Dont render serverUrl on callbacks MethodEndpoint component #939
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This adds a new prop to the MethodEndpoint component to give it context as to where it is rendering. If the context is
callback
it does not prepend the serverUrl, any other context and the serverUrl is prepended.Motivation and Context
Callback methods are rendering the path of the endpoint with the server URL which is incorrect. The callback section should only render the endpoint the spec defines. For example in the petstore versioned spec, the plugin currently renders this url in the method endpoint component
https://petstore.swagger.io/v2http://notificationServer.com?url={$request.body#/callbackUrl}&event={$request.body#/eventName}
The OpenAPI specs section on callbacks details that it's possible for this endpoint value to reference the requestBody which could be a nice feature to add but at the moment this change simply updates incorrect behaviour of the rendering component.
How Has This Been Tested?
Worked against the Callbacks section on http://localhost:3000/petstore_versioned/subscribe-to-the-store-events
Screenshots (if appropriate)
Rendering the endpoint and server url
Rendering the endpoint url only
Types of changes
Checklist