Skip to content

description and / or title of properties and endpoints #85

@nklamann

Description

@nklamann

It would be useful if the generated python code would contain docstrings from the schema.

This works for classes only. It would be great for service endpoints and attributes too.

This is not a templating issue. I tested this with vour example here https://marcomuellner.github.io/openapi-python-generator/tutorial/
and the follwing template

# generated by openapi-python generator
from typing import *
from pydantic import BaseModel, Field
{% for property in properties %}
{% if property.type.import_types is not none %}
{% for import_type in property.type.import_types %}
{{ import_type }}
{% endfor %}
{% endif %}
{% endfor %}

class {{ schema_name }}(BaseModel):

    """
    {{ schema.title }}
    {{ schema.description }}
    """

    {% for property in properties %}

    {{ property.name | replace("@","") | replace("-","_") }} : {{ property.type.converted_type | safe }} = Field(alias="{{ property.name }}" {% if not property.required %}, default = {{ property.default }} {% endif %})

    """
    {{ property.title }}
    {{ property.description }}
    """

    {% endfor %}

Team.py has no docstrigs fro its attributes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions