It will be useful for people using the Swagger JS to view the operationId on the Swagger UI.
Is there an option to enable this?
operationId is not mandatory, so I'm not sure there would be a lot of benefit showing it.
Yes, I know. Other fields are also not mandatory. It can be optionally shown. The benefit is for other tools or libraries (like Swagger JS) that are using this field to consume the API.
Not quite the same.
Just not sure how to display it clearly and not clutter the current UI which is busy as it is.
+1 Working with remote development teams, the swagger UI is an important tool for effective dev and testing though it is rather confusing for the devs to have to ref the actual spec to get the operationId. We have been adding the operationId to the path summary but it would be nice if the UI could display this some how. Adding the operationId to the summary is not good practice cause it is duplicating data in multiple places for no reason.
We can put in near the description, with a different color. Wouldn't be too hard, just a matter of clutter as @webron says. It is useful info though.
Uploaded a pull-request which adds this feature.
See #2568.
Please add this feature back in 3.x
@alexkravets This feature is available through an option called "displayOperationId". Just set that to true in your index.html file and you should be in business. Hope this helps you!
const ui = SwaggerUIBundle({
url: "http://petstore.swagger.io/v2/swagger.json",
dom_id: '#swagger-ui',
presets: [
SwaggerUIBundle.presets.apis,
SwaggerUIStandalonePreset
],
plugins: [
SwaggerUIBundle.plugins.DownloadUrl
],
layout: "StandaloneLayout",
displayOperationId: true,
validatorUrl: null,
})
@Celadora - it was @alexkravets who submitted the PR to add that functionality ;)
Thanks for the help everyone, closing the ticket.
Is it possible to set displayOperationId as environment variable when using Docker? I have tried to set -e DISPLAY_OPERATION_ID=true, but it did not have any effect.
Hi @Celadora I did the same thing in my swagger-ui.html still the operation Id is not showing up in my UI can you help me with this?
Most helpful comment
@alexkravets This feature is available through an option called "displayOperationId". Just set that to true in your index.html file and you should be in business. Hope this helps you!