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

String Enum in body Param generating incorrect schema #1608

Open
SulanthaM opened this issue Jun 20, 2023 · 2 comments
Open

String Enum in body Param generating incorrect schema #1608

SulanthaM opened this issue Jun 20, 2023 · 2 comments

Comments

@SulanthaM
Copy link

Describe the bug
Incorrect spec is generated when a body param defined with string Enum type.

To Reproduce
Steps to reproduce the behavior: Definition
@Param modify-org-type body string false "type" Enums(PHARMA, ACADEMIC, VENDOR, INDUSTRY, PARTNER)

Result

                 {
                        "enum": [
                            "PHARMA",
                            "ACADEMIC",
                            "VENDOR",
                            "INDUSTRY",
                            "PARTNER"
                        ],
                        "description": "type",
                        "name": "modify-org-type",
                        "in": "body",
                        "schema": {
                            "type": "string"
                        }
                    }

Expected behavior
Correct/Valid swagger schema

                 {
                  
                        "description": "type",
                        "name": "modify-org-type",
                        "in": "body",
                        "schema": {
                            "type": "string",
                            "enum": [
                              "PHARMA",
                              "ACADEMIC",
                              "VENDOR",
                              "INDUSTRY",
                              "PARTNER"
                              ]
                        }
                    }

Your swag version
e.g. 1.16.0

Your go version
e.g. 1.19.0

@hohobilly
Copy link
Contributor

Encountered the same issue. Attempting to fix it with #1625

@ubogdan
Copy link
Contributor

ubogdan commented Jul 18, 2023

Merged.

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