marshmallow-code / marshmallow-code/apispec
Interest in taking Schema description from Schema.__doc__ docstring
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 1.2k
- Forks
- 202
- Avg merge
- 3h 38m
- Merged PRs (30d)
- 3
Description
You take the object description from Meta.description in https://github.com/marshmallow-code/apispec/blob/8cbbbeb1630ff4d5732f2287b4985df84681af47/src/apispec/ext/marshmallow/openapi.py#L260
Do you have interest in a pull request to also get it from the Schema docstring? Something like:
if hasattr(Meta, "description"):
jsonschema["description"] = Meta.description
elif schema.__doc__:
jsonschema["description"] = schema.__doc__
You can do the same formating as in https://flask-smorest.readthedocs.io/en/latest/openapi.html#add-summary-and-description.
Makes sense?
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
Start in src/apispec/ext/marshmallow/openapi.py around the existing Meta.description handling. Check how schema descriptions are generated and whether the referenced flask-smorest formatting is applicable; done means Schema.doc can provide a description when Meta.description is absent, without replacing an explicit Meta.description.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- openapi, python
- Domain
- api, documentation
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100