How to specify examples of the responses? #244
                  
                    
                      DimShadoWWW
                    
                  
                
                  started this conversation in
                General
              
            Replies: 1 comment
-
| I hope this will help you: type GenericAnswer struct {
	Message string `json:"message" example:"this is an example"`
}after declaring my server with: mux := fuego.NewServer(fuego.WithAddr("127.0.0.1:8000"))i register a Get endpoint with some options: fuego.Get(mux, "/ready", readiness, fuego.OptionAddResponse(http.StatusTeapot, "Teapot", fuego.Response{
	Type: GenericAnswer{},
}))the used readiness function looks like this: func readiness(c fuego.ContextNoBody) (GenericAnswer, error) {
	if !ready {
		return GenericAnswer{Message: "not ready"}, fuego.HTTPError{Status: http.StatusTeapot}
	}
	return GenericAnswer{Message: "ready"}, nil
}
 running the server with mux.Run() | 
Beta Was this translation helpful? Give feedback.
                  
                    0 replies
                  
                
            
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
        
    
Uh oh!
There was an error while loading. Please reload this page.
-
I tried to specify examples of responses on the endpoints but could not find how in the code.
All example values in OpenAPI are autogenerated and do and do not take into account the name of tags if the response is in xml format.
The example for this schema:
is this one:
instead of:
Beta Was this translation helpful? Give feedback.
All reactions