aws / aws/chalice

How to add tags for my swagger

Open
#2,027 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11.1k
Forks
1k
Avg merge
1d 22h
Merged PRs (30d)
2

Description

Hello there,

I generated my swagger via the command "chalice generate-models" and although it finds all the routes for me, these are empty and do not return anything do not find the arguments.

```

@app.route("/test", methods=["GET", "PUT", "POST"], cors=True)
def test():
"""
Retrieves a simple message.
---
tags:
- Hello
parameters:
- name: name
in:query
type: thong
required: true
description: Your name.
responses:
200:
description: A welcome message.
plan:
type: object
properties:
message:
type: thong
"""
hello_world = {"hello": "world", "environment": ENVIRONMENT}
return Response(body=hello_world, status_code=200, headers={"Content-Type": "text/plain"})
```

which is not really very practical and useful
i would like to get something like that:

```
@doc.summary("Récupère un message simple.")
@doc.tag('hello')
@doc.parameter('name', description="Votre nom.", required=True, location="query", type=str)
@doc.response(200, description="Un message de bienvenue.", schema={
'type': 'object',
'properties': {
'message': {
'type': 'string'
}
}
})
```

Thanks for yours answers

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the documented route example with `chalice generate-models`, comparing the generated Swagger output with the desired decorator-based API shown in the issue. Determine how route docstrings currently provide tags, parameters, responses, and schemas, and define completion as generating useful non-empty entries for those fields or supporting the requested decorator form.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.