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

Body param array with user defined struct produces bad output #547

Closed
Kelwing opened this issue Oct 24, 2019 · 2 comments
Closed

Body param array with user defined struct produces bad output #547

Kelwing opened this issue Oct 24, 2019 · 2 comments

Comments

@Kelwing
Copy link

Kelwing commented Oct 24, 2019

Describe the bug
When I specify a parameter as a slice of a custom struct in the body, it produces invalid output. The schema type is set to the name of the struct instead of 'array'.

To Reproduce
Specify a Param as follows

@Param mystruct body []MyStruct true "MyStruct"

It produces the following schema:

        schema:
          items:
            $ref: '#/definitions/main.MyStruct'
          type: MyStruct

Expected behavior
Schema should be:

        schema:
          items:
            $ref: '#/definitions/main.MyStruct'
          type: array

Your swag version
v1.6.3

Your go version
1.12.3

Desktop (please complete the following information):

  • OS: Windows
  • Browser: Chrome
  • Version: 77.0.3865.120

Additional context
N/A

@gmarcial
Copy link

gmarcial commented Dec 5, 2019

Ya

I find myself in the same problem...

@sdghchj
Copy link
Member

sdghchj commented Dec 24, 2019

fixed by PR #579

@sdghchj sdghchj closed this as completed Jan 3, 2020
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

3 participants