Skip to content

More thorough docstrings on APIs and models #503

Closed
@rtaycher

Description

@rtaycher

Is your feature request related to a problem? Please describe.

Openapi documents can have a lot of information about apis and types and the client isn't currently adding
a good chunk of that information tothe docstring

Leading to people needing to refer back to the openapi file instead of the library.

Describe the solution you'd like
I think we could improve this situation. We should add as much context as is relevant to the docstrings.
From there they would be visible in the IDE and visible in any generated module documentation.

It would be nice if they were well formatted and maybe cross-refrenced but that's not the point of this issue.
The point is to have as much information as possible in the docstrings (inside the IDE or generated module documentation without looking at the openapi document)

currently API and model generation only uses the description field.

It looks like the api has at least a description and summary attribute which documents may or may not use

The models have attrs which have a description and example field. I can't find a way for attrs to get per attr documentation but at the very least it could be added to the class.

Additional context
I was thinking of starting with something like
def sync(
{{ arguments(endpoint) | indent(4) }}
) -> Optional[{{ return_string }}]:
"""{% if endpoint.summary %}{{ endpoint.summary | wordwrap(73)}}
{% else %}
{{ endpoint.title | wordwrap(73)}}
{% endif %}
{{ endpoint.description | wordwrap(73)}}"""

for endpoint_module.py.jinja. Well that plus if we have query fields instead of a model also including description and example for each of them

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions