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

Unable to hide field in derived type #3438

Open
Mapiarz opened this issue Apr 5, 2024 · 1 comment
Open

Unable to hide field in derived type #3438

Mapiarz opened this issue Apr 5, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@Mapiarz
Copy link

Mapiarz commented Apr 5, 2024

Based on Discord discussion here: https://discord.com/channels/689806334337482765/1225406859926704188

Basically I have a type which derives from another. I want to exclude a field in my derived type. Marking as strawberry.Private in the derived class doesn't do anything.

@strawberry.type
class Foo:
    value: int = strawberry.field(description="foo")

@strawberry.type
class Bar(Foo):
    value: strawberry.Private[int]

I would expect the value field not to be exposed on type Bar in the schema.

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
@Mapiarz Mapiarz added the bug Something isn't working label Apr 5, 2024
@Mapiarz
Copy link
Author

Mapiarz commented Apr 5, 2024

Right now the only way of achieving this is to remove the field from Bar.__strawberry_definition__.fields before the Schema is created. That was suggested in the Discord discussion.

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

1 participant