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

Swagger parameters in path vs. method #196

Closed
dmulter opened this issue Aug 29, 2016 · 2 comments
Closed

Swagger parameters in path vs. method #196

dmulter opened this issue Aug 29, 2016 · 2 comments

Comments

@dmulter
Copy link

dmulter commented Aug 29, 2016

Placing the @api.param() decorator after a route definition generates a Swagger definition that works perfectly, but the "parameters" JSON is placed in the "paths" section. I need to make sure that the "parameters" actually shows up under each of the method definitions, as Amazon API Gateway needs this. Strictly speaking it is not required by the Swagger specification, but control over where the definition goes is important.

Moving the @api.param() so it decorates the method function does not work as it will cause duplicate Swagger parameter definitions.

@dmulter
Copy link
Author

dmulter commented Oct 2, 2018

Just installed the new 0.12.1 version that includes this fix. Unfortunately the parameters JSON for the route parameters still appears within the paths section, and is NOT replicated under each of the method routes.

This is the generated JSON for a simple API definition (minus extra lines for clarity):

"paths": {
    "/routes/{route_id}": {
        "parameters": [
            {
                "in": "path",
                "description": "route ID",
                "name": "route_id",
                "required": true,
                "type": "integer"
            }
        ],
        "get": {
        },
        "delete": {
        }
    }
}

But it needs to show up as:

"paths": {
    "/routes/{route_id}": {
        "get": {
            "parameters": [
                {
                    "in": "path",
                    "description": "route ID",
                    "name": "route_id",
                    "required": true,
                    "type": "integer"
                }
            ]
        }
        "delete": {
            "parameters": [
                {
                    "in": "path",
                    "description": "route ID",
                    "name": "route_id",
                    "required": true,
                    "type": "integer"
                }
            ]
        }
    }
}

@dmulter
Copy link
Author

dmulter commented Jan 2, 2020

Please re-open if possible. Thanks!

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