Questions tagged [go-swagger]

Swagger 2.0 implementation for go

94 questions
0
votes
1 answer

Redigo connection pool - how to get more connections?

I am building a performance oriented REST-API. The skeleton was built with go-swagger. The API has 3ms to answer and is succeeding in single-use while only needing between 0.5ms - 0.8ms for the response. There are two calls made to redis. This is…
whatever.idc
  • 92
  • 1
  • 1
  • 10
0
votes
0 answers

server panic when trying to implement qor dashboard with go-swagger generated api server

2021/02/12 17:17:56 Finish [GET] /admin Took 0.05ms 2021/02/12 17:17:56 http: panic serving 127.0.0.1:50746: runtime error: invalid memory address or nil pointer dereference goroutine 65 [running]: net/http.(*conn).serve.func1(0xc00076f040) …
0
votes
3 answers

go-swagger restapi/configure_todo_list.go - api.TodoGetHandler undefined error

I am a newbie in go and go-swagger. I am following steps in Simple Server tutorial in goswagger.io. I am using Ubuntu 18.04, swagger v0.25.0 and go 1.15.6. Following the same steps, there are a few differences of the files generated. For instance,…
AEWRocks
  • 157
  • 1
  • 2
  • 10
0
votes
1 answer

go-swagger Oauth2 Authentication sample

https://github.com/go-swagger/go-swagger/blob/master/examples/oauth2/restapi/configure_oauth_sample.go Could anyone explain what this piece of code is for? // This demonstrates how to enrich and pass custom context keys. // In this case, we cache…
WWTLF
  • 440
  • 1
  • 5
  • 13
0
votes
1 answer

go-swagger how to add tags with descriptions?

Basically when I am writing my yaml files manually I can always just define a tags: section and define my tags one by one after that with -name: and description:. Is there a way to define these in my go-swagger comments so the generator picks them…
la_f0ka
  • 1,773
  • 3
  • 23
  • 44
0
votes
1 answer

Unable to connect a go-swagger parameter to a route

I have the following go-swagger annotation: // swagger:parameters callbackReg type registrationParms struct { // Description of callback. // in: query // required: true callback string } // OK indicates that the HTTP request was…
cbarlock
  • 105
  • 10
0
votes
1 answer

One model for POST and GET with different "required" field

I use go-swagger. I have model like: // Pet pet // swagger:model type Pet struct { // id ID int64 `json:"id,omitempty"` // name // Required: true Name *string `json:"name"` } and for example in my POST field Name have to be…
Bubuu
  • 1
  • 3
0
votes
1 answer

How to serve websocket with go-swagger?

I'm trying to serve a chat websocket within my go-swagger API. I'm using this example: https://github.com/gorilla/websocket/tree/master/examples/chat I tried attaching it to the http when the server starts, but after further reading I see that this…
Wuzi
  • 386
  • 7
  • 17
0
votes
1 answer

ISTIO in GKE with Existing Application Not Working

I am attempting to get ISTIO up and running on an existing cluster and enabled for existing microservices. Unfortunately I am not knowledgeable enough on ISTIO and Envoy to adequately diagnose what the issues I'm having are. What I did: Installed…
mornindew
  • 1,993
  • 6
  • 32
  • 54
0
votes
1 answer

Go Swagger ability to write response for async reactive code

I am using goswagger to generate my restAPI code and as part of this generated code for writing responses I should return middleware.Responder. I would like to have the option to write the response directly using the API client as I am using the…
0
votes
1 answer

go-swagger do not validates Body in POST request

Swagger ignoring required fields in body of POST request. Steps to reproduce: Describe swaggerfile swagger: "2.0" info: title: Sample API description: API description in Markdown. version: 1.0.0 host: api.example.com schemes: -…
Vadim Filin
  • 342
  • 3
  • 12
0
votes
2 answers

go-swagger WriteResponse

I am using go-swagger but I have an case where I want to write a string to a response. I need to call the "WriteResponse" function WriteResponse(rw http.ResponseWriter, producer runtime.Producer) The issue that I am having is that I don't know…
mornindew
  • 1,993
  • 6
  • 32
  • 54
0
votes
1 answer

go-swagger not calling my header check

I have an api generated through go-swagger. I am trying to put in a session check it is not firing as I expected. I followed an example that I found in github but didn't seem to work for me. My code: // Applies when the "X-Session-Key" header is…
mornindew
  • 1,993
  • 6
  • 32
  • 54
0
votes
1 answer

Swagger parameter issue

Below is my code: // swagger:route GET /user_list get_user // // Get a user profile // Parameters: // user_id: userParam // Consumes: // - application/json // Produces: // - application/json // // Responses: // 200: UserResponse In my model…
Sapna Mishra
  • 187
  • 1
  • 2
  • 15
0
votes
2 answers

Golang swagger returns 404 not found

I followed the instructions on this github page https://github.com/yvasiyarov/swagger using the example project and the api documentation generated fine. But when I run the last command to run and display the API page I always get 404 not found when…
Sakib
  • 1,503
  • 4
  • 26
  • 39