You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Also not all characters are accepted, instead of being correct w.r.t. Swagger validator.
This snippet will add explicit operationIds that work and look nice in the permalink URL, e.g.:
PUT.v1.permission.role.RoleId.user.me.UserId
POST.v1.user.instant-check.email
--|A fix for <https://github.com/swagger-api/swagger-ui/issues/4929>.addExplicitOperationIds::Swagger->Swagger
addExplicitOperationIds =
over
paths
(InsOrd.mapWithKey
(\path ->let f method method' = over method (map (setId method' path))
in f get "GET". f put "PUT". f post "POST". f Data.Swagger.delete "DELETE".
f options "OPTIONS".
f head_ "HEAD".
f patch "PATCH"))
wheresetId::Text->FilePath->Operation->Operation
setId method path = over operationId (<|> (Just. swaggerUiAcceptedId $ method ++ pack path))
swaggerUiAcceptedId::Text->Text
swaggerUiAcceptedId =
intercalate ".".filter (not.null) .T.split (\c ->not (C.isAlphaNum c || c =='-'))
Note: this probably can be closed immediately, I just wanted to leave this simple copy-paste somewhere indexable for people that will face this problem.
The text was updated successfully, but these errors were encountered:
So if there’s no explicit
operationId
, Swagger-UI will generate fragment names for theirdeepLinking
.But those fragment names are rather ugly.
Also they have a history of breaking deep linking, see:
docExpansion: 'none'
, for operations that don’t have an explicitoperationId
. swagger-api/swagger-ui#4929operationId
swagger-api/swagger-ui#4895Also not all characters are accepted, instead of being correct w.r.t. Swagger validator.
This snippet will add explicit
operationId
s that work and look nice in the permalink URL, e.g.:PUT.v1.permission.role.RoleId.user.me.UserId
POST.v1.user.instant-check.email
Note: this probably can be closed immediately, I just wanted to leave this simple copy-paste somewhere indexable for people that will face this problem.
The text was updated successfully, but these errors were encountered: