Questions tagged [go-swagger]

Swagger 2.0 implementation for go

94 questions
3
votes
0 answers

How to validate all properties of an object in go-swagger?

I have a swagger.json which accepts a POST body as an object with some required properties with data types. I can see the ServeError() being invoked when either of the properties is missing or if one is a wrong data type. It stops and gives the…
rbk
  • 283
  • 2
  • 3
  • 16
2
votes
0 answers

Using go-swagger, how to have the @description reference an external Markdown file?

So I am using the above two technologies to autogenerate my swagger.yaml file that then is read by Redoc and served to the clients. This is the step in my makefile: swag init -g internal/delivery/rest/router.go --output swagger/ --outputTypes…
Matias Barrios
  • 4,674
  • 3
  • 22
  • 49
2
votes
1 answer

Go-Swagger autogen documentation

I'm trying to create my API documentation using go-swagger. The structure of my project: In the cmd/main_api folder, I'm launching swag init. Swagger successfully pulls up the annotation from main.go, but does not pull up the annotation from…
2
votes
0 answers

What is strfmt.Registry in go-swagger

I have a error model that looked like this Error: type: object properties: code: type: string example: missing_field description: This field contains a string succinctly identifying the problem. message: …
BhanuKiran
  • 2,631
  • 3
  • 20
  • 36
2
votes
0 answers

How to define /health endpoint without version of base url using goswagger in golang

I've generated swagger using goswagger in golang application. My base url is [ Base URL: /{service-name}/api/v1 ] and health endpoint after click on try out option in swagger /{service-name}/api/v1/health but in actual it should be without version…
2
votes
0 answers

go-swagger - file upload

I'm using go-swagger for generating swagger file for our apis I've been trying to add comments for an api that is used to upload a single file but the annotations for file and form data simply is not working here is the comments for the said api //…
Amirreza KN
  • 21
  • 1
  • 6
2
votes
1 answer

How to implement new media types in swagger backend

I have created a swagger specification which produces "application/zip" /config: get: produces: - application/zip responses: 200: # OK description: All config files schema: type: string …
aman
  • 278
  • 3
  • 11
2
votes
2 answers

Curl failing with this swagger spec

I have created a swagger spec /config/download: post: summary: Download config consumes: - application/json produces: - application/zip parameters: - in: body name: config schema: type: array items: …
aman
  • 278
  • 3
  • 11
2
votes
2 answers

Invalid Swagger spec: swagger spec at "swagger.yml" is invalid against swagger specification 2.0

I am trying to use Swagger. Below is the swagger.yml file. swagger: "2.0" basePath: /myapp/api info: description: My description title: My title version: 0.1.0 produces: - application/json consumes: - application/json schemes: -…
Dalton Cézane
  • 3,672
  • 2
  • 35
  • 60
2
votes
4 answers

go-swagger: command not found

Trying to install go-swagger on Ubuntu. I have installed brew(Linuxbrew): sh -c "$(curl -fsSL https://raw.githubusercontent.com/Linuxbrew/install/master/install.sh)" Next I did: brew tap go-swagger/go-swagger brew install go-swagger typing swagger…
andrew17
  • 851
  • 2
  • 10
  • 25
2
votes
1 answer

Customize go-swagger generate spec

I am using go-swagger to generate spec with command swagger generate spec. Everything is working fine, however I want to mitigate possible mismatch between specs and actual implementation. For example, the below model is having required : true in…
sayboras
  • 4,897
  • 2
  • 22
  • 40
2
votes
1 answer

How to use go-swagger to define an attachment download

I am using go-swagger to download attachments. These are small multi-line files, and there is just a browser on the other end. I tried defining the response as 'string', but can find no way to populate the payload with multiline text, it arrives…
EdS
  • 31
  • 3
2
votes
1 answer

swagger UI unable to process swagger.json that redoc is able to

I have the following simple swagger.json file. This is generated using go-swagger annotations for a golang service. I am able to get the UI page running with redoc. I want to display it with swagger-ui but I cannot get it to work. It shows an error…
Sakib
  • 1,503
  • 4
  • 26
  • 39
1
vote
0 answers

How to use different model packages in different group when generate API client with go-swagger?

I have two groups of operation, for example: task and file. And their models are pre-defined in two packages, like: my/task/models and my/file/models. When I generate the API client, I found that the --existing-models param seems can use only one…
1
vote
0 answers

go-swagger: how to generate multiple required headers in security section of swagger.json from code

I want to have an authorization scheme where both authorization1 header and authorization2 headers are required. So the resulting json should look like: "security": [ { "authorization1": [ "[]"], "authorization2": [ "[]"], } …
David Michael Gang
  • 7,107
  • 8
  • 53
  • 98