marshmallow-code / marshmallow-code/apispec

Interest in taking Schema description from Schema.__doc__ docstring

Open
#861 0 comments 0 reactions 0 assignees View on GitHub

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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.