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
Is your feature request related to a problem? Please describe.
When defining a success response that uses a non-struct type, such as a string, it is currently not possible to define an example for it. As a result, when viewing the Swagger UI, the response example section simply displays "string." This lack of customization reduces the clarity and usability of the API documentation. I would like a way to define examples for non-struct types in Swagger.
Describe the solution you'd like
Similar to how examples are defined for parameters (#1119 ), it would be great to have a similar format for responses. For example: // @Success 201 {string} string "User created successfully" example("User created successfully")
With this implementation, the Swagger UI would display:
Additional context
The example content should be added to the response schema as per the OpenAPI v2 specification (reference here):
Is your feature request related to a problem? Please describe.
When defining a success response that uses a non-struct type, such as a string, it is currently not possible to define an example for it. As a result, when viewing the Swagger UI, the response example section simply displays "string." This lack of customization reduces the clarity and usability of the API documentation. I would like a way to define examples for non-struct types in Swagger.
Describe the solution you'd like
Similar to how examples are defined for parameters (#1119 ), it would be great to have a similar format for responses. For example:
// @Success 201 {string} string "User created successfully" example("User created successfully")
With this implementation, the Swagger UI would display:
Additional context
The
example
content should be added to the response schema as per the OpenAPI v2 specification (reference here):The text was updated successfully, but these errors were encountered: