Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parameters not detected with multiple structs in one statement #2020

Open
mrnatelantz opened this issue Jul 24, 2019 · 0 comments
Open

Parameters not detected with multiple structs in one statement #2020

mrnatelantz opened this issue Jul 24, 2019 · 0 comments
Labels
generate spec Related to spec generation from code scanner

Comments

@mrnatelantz
Copy link

Problem statement

Noticed while adding Parameters from a package that declares multiple structs in one statement.
Appears that the annotation "//swagger:parameters" needs to be above the "type" keyword
I expected the annotation "//swagger:parameters" to be able to be inserted directly above each struct declaration

Steps to reproduce

This will NOT work. Notice the syntax for declaring multiple structs/types

type (
	//swagger:parameters myOpID
        Request struct {
		//in:body
		//swagger:name -
	        RequestBody struct {
                        //Foo of body
			Foo string `json:"foo"`
                        //Bar of body
                        Bar string `json:"bar"`
		}
	}
)

This will work.

	//swagger:parameters myOpID
       type Request struct {
		//in:body
		//swagger:name -
	        RequestBody struct {
                        //Foo of body
			Foo string `json:"foo"`
                        //Bar of body
                        Bar string `json:"bar"`
		}
	}

Environment

swagger version: 2.0
go version: go version go1.10.4 linux/amd64
OS: Ubuntu 18.04.2 LTS

To get the spec to generate was an easy fix. My main problem is that the documentation has dictated (minimally) how application code is written outside of comment annotations.

FYI: I am new to go so forgive me if I used incorrect terminology

@fredbi fredbi added the generate spec Related to spec generation from code label Jul 24, 2019
@fredbi fredbi added the scanner label Dec 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generate spec Related to spec generation from code scanner
Projects
None yet
Development

No branches or pull requests

2 participants