Dynamically generate "examples" #1865
manuelarte
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi,
Imagine that we have the following Error response when there is an error in our application
When I generate the documentation with swag, I get a "proper" example in swagger.
But now I want to reuse that ErrorResponse for different error scenarios, and I want to use a different "example"
But I can't have different "examples" for the same Go struct. What I am doing right now, it's to create different structs to cover the different examples that I want to show.
So, something like this:
But, is it possible to do it in a different way? Is it possible to dynamically generate the examples in any way?
Beta Was this translation helpful? Give feedback.
All reactions