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

Add support for more complex function scoped types #1812

Open
KristofferFJ opened this issue May 27, 2024 · 0 comments
Open

Add support for more complex function scoped types #1812

KristofferFJ opened this issue May 27, 2024 · 0 comments

Comments

@KristofferFJ
Copy link
Contributor

KristofferFJ commented May 27, 2024

Is your feature request related to a problem? Please describe.
Developed in #1283, it is possible to define function scoped very simple types:

package main

// @Param request body main.Fun.request true "query params" 
// @Success 200 {object} main.Fun.response
// @Router /test [post]
func Fun()  {
	type request struct {
		Name string
	}
	
	type response struct {
		Name string
		Child string
	}
}

But it fails when the request or response are more complex, for instance:

package main

// @Param request body main.Fun.request true "query params" 
// @Success 200 {object} main.Fun.response
// @Router /test [post]
func Fun()  {
	type request struct {
		Name string
	}
	
        type child struct {
                Name string
        }

	type response struct {
		Child child
	}
}

Describe the solution you'd like
It would be nice to be able to define more complex request and response types.

Describe alternatives you've considered
It is of course possible to define more complex request and response types if the types are not function scoped.
This is not the preferred solution for my team as we find it clutters a bit.

Further information
I have made a suggestion about how to fix this here: #1813

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant