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

Descriptions don't work with pydantic decorators #3484

Open
pmowrer opened this issue May 3, 2024 · 2 comments
Open

Descriptions don't work with pydantic decorators #3484

pmowrer opened this issue May 3, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@pmowrer
Copy link

pmowrer commented May 3, 2024

Describe the Bug

Works as expected with regular @strawberry.input decorator

@strawberry.input
class User:
    id: str = strawberry.field(description="Id of the user")
    name: str | None = strawberry.field(description="Name of the user", deprecation_reason="No longer used")
input User {
  """Id of the user"""
  id: String!    

  """Name of the user"""
  name: String @deprecated(reason: "No longer used")
}

Doesn't work as expected with @strawberry.experimental.pydantic.input decorator

class UserPyd(BaseModel):
  id: str
  name: str | None

@strawberry.experimental.pydantic.input(model=UserPyd)
class User:
    id: str = strawberry.field(description="Id of the user")
    name: str | None = strawberry.field(description="Name of the user", deprecation_reason="No longer used")
input User {
  id: String!
  name: String @deprecated(reason: "No longer used")
}

System Information

  • Operating system: Ubuntu
  • Strawberry version (if applicable): 0.227.3

Additional Context

Upvote & Fund

  • We're using Polar.sh so you can upvote and help fund this issue.
  • We receive the funding once the issue is completed & confirmed by you.
  • Thank you in advance for helping prioritize & fund our backlog.
Fund with Polar
@pmowrer pmowrer added the bug Something isn't working label May 3, 2024
@mecampbellsoup
Copy link
Contributor

mecampbellsoup commented May 3, 2024

As a sanity check, does removing the pass change anything? It definitely shouldn't but, just in case I suppose...

@strawberry.experimental.pydantic.input(model=UserPyd)
class User:
    id: str = strawberry.field(description="Id of the user")
    name: str | None = strawberry.field(description="Name of the user", deprecation_reason="No longer used")
    pass

@pmowrer
Copy link
Author

pmowrer commented May 8, 2024

Thanks for catching the typo! Unfortunately doesn't impact the bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants