marshmallow-code / marshmallow-code/flask-smorest
Schema description from docstring
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 717
- Forks
- 77
- Avg merge
- 7h 49m
- Merged PRs (30d)
- 3
Description
I wondered why the models in the overview at the end of the Swagger UI didn't contain a model description and went down the rabbit hole to find that it seems to be an [apispec issue](https://github.com/marshmallow-code/apispec/issues/208).
It seems the apispec project doesn't see a need to provide an easy way to add descriptions to a marshmallow schema class since it's already possible to do
```
class ASchema(Schema):
a = fields.Int(description="description for a field")
spec.definition('ASchema', schema=ASchema, description="description for a definition, or a schema")
```
What would be a clean way to apply this to flask-smorest? Or am I doing it all wrong and there is a better way to have a *components.schemas[].description* added to in the resulting openapi.json?
I'd love if the class docstring could be used for this.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No file or test is named. Start by tracing how marshmallow schemas are passed to apispec and how the OpenAPI components.schemas entries are generated; the work is done when a schema class docstring produces a components.schemas[].description in the resulting openapi.json, with coverage for that behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- flask, openapi, python
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100