Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing field descriptions to graphiql documentation #52

Open
jdhaines opened this issue Jan 12, 2021 · 0 comments
Open

Passing field descriptions to graphiql documentation #52

jdhaines opened this issue Jan 12, 2021 · 0 comments

Comments

@jdhaines
Copy link

I'm trying to pass a description from one of the pydantic fields to the graphiQL documentation. I can't seem to get it to be recognized. It seems to be supported in graphene directly on the fields like this:

class Person(ObjectType):
    first_name = graphene.String(required=True)
    last_name = graphene.Field(String, description='Surname')

In pydantic it's supported like this:

class MainModel(BaseModel):
    """
    This is the description of the main model
    """
    snap: int = Field(
        42,
        title='The Snap',
        description='this is the value of snap',
        gt=30,
        lt=50,
    )

I've implemented the pydantic style description and don't see any change to the GraphiQL documentation on that field. Any ideas how to pass it over, or is this simply not supported with this library? I'm following the excellent tutorial here: https://testdriven.io/blog/fastapi-graphql/ but they don't spend any time on the self-documenting nature of graphql which is something really enjoy.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant