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

[Bug]Parameter description not included in openapi.json #18

Closed
ingarpedersen opened this issue Dec 8, 2021 · 1 comment
Closed

[Bug]Parameter description not included in openapi.json #18

ingarpedersen opened this issue Dec 8, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@ingarpedersen
Copy link

Describe the bug
When using Parameter class to describe a method parameter, the description is not included in the resulting openapi.json

To reproduce
The following code tests 3 ways of documenting parameters, the output is almost identical except that test2 is missing the description in the output

@app.route('/test1/<val1>')
async def get_test1(request, val1: int):
    """
    openapi:
    ---
    operationId: get.test1
    parameters:
      - name: val1
        in: path
        description: val1 path param
        required: true
        schema:
          type: integer
          format: int32
    """
    return HTTPResponse("ok")

@app.route('/test2/<val1>')
@openapi.parameter(parameter=Parameter(name='val1', schema=int, location='path', description='val1 path param'))
async def get_test2(request, val1: int):
    return HTTPResponse("ok")

@app.route('/test3/<val1>')
@openapi.parameter('val1', description='val1 path param', required=True, schema=int)
async def get_test3(request, val1: int):
    return HTTPResponse("ok")

Expected behavior
The description part of Parameter should be included in the openapi.json output

Environment (please complete the following information):
OS: Windows 10
Python: 3.10
Sanic: 21.9.3
sanic-ext: 21.9.3

@ChihweiLHBird
Copy link
Member

ChihweiLHBird commented Dec 21, 2021

Fixed in #21, test case was added as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants