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

fix: body object without package name use default package name #591

Merged
merged 2 commits into from
Dec 29, 2019
Merged

fix: body object without package name use default package name #591

merged 2 commits into from
Dec 29, 2019

Conversation

sdghchj
Copy link
Member

@sdghchj sdghchj commented Dec 27, 2019

Describe the PR
body object without package name in param comments use default package name

Relation issue
code:

// @summary
// @description
// @router /aaa [post]
// @Param test body Wrapper false "test"
// @success 200
func Handler() {
}

type Wrapper struct {
	Test int
}

before PR:

{
    "swagger": "2.0",
    "info": {
        "contact": {},
        "license": {}
    },
    "basePath": "/",
    "paths": {
        "/aaa": {
            "post": {
                "parameters": [
                    {
                        "description": "test",
                        "name": "test",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/Wrapper"
                        }
                    }
                ],
                "responses": {
                    "200": {}
                }
            }
        }
    }
}

after PR:

{
    "swagger": "2.0",
    "info": {
        "contact": {},
        "license": {}
    },
    "basePath": "/",
    "paths": {
        "/aaa": {
            "post": {
                "parameters": [
                    {
                        "description": "test",
                        "name": "test",
                        "in": "body",
                        "schema": {
                            "$ref": "#/definitions/main.Wrapper"
                        }
                    }
                ],
                "responses": {
                    "200": {}
                }
            }
        }
    },
    "definitions": {
        "main.Wrapper": {
            "type": "object",
            "properties": {
                "test": {
                    "type": "integer"
                }
            }
        }
    }
}

@codecov-io
Copy link

codecov-io commented Dec 27, 2019

Codecov Report

Merging #591 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #591      +/-   ##
==========================================
+ Coverage   85.99%   86.01%   +0.01%     
==========================================
  Files           7        7              
  Lines        1635     1637       +2     
==========================================
+ Hits         1406     1408       +2     
  Misses        144      144              
  Partials       85       85
Impacted Files Coverage Δ
gen/gen.go 96.74% <100%> (+0.05%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9a96538...1cf1764. Read the comment docs.

Copy link
Member

@easonlin404 easonlin404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can I know why there is a need to use the default package name?

@sdghchj
Copy link
Member Author

sdghchj commented Dec 29, 2019

can I know why there is a need to use the default package name?

for "@success" have already been

Copy link
Member

@easonlin404 easonlin404 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@easonlin404 easonlin404 merged commit 549622f into swaggo:master Dec 29, 2019
@easonlin404
Copy link
Member

@sdghchj Thanks, man. 👍

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

Successfully merging this pull request may close these issues.

None yet

3 participants