strawberry-graphql / strawberry

A GraphQL library for Python that leverages type annotations 🍓
https://strawberry.rocks
MIT License
3.84k stars 510 forks source link

feat: Excluding a field from a type by making it private #3539

Open Eraldo opened 2 weeks ago

Eraldo commented 2 weeks ago

Describe the Bug/Feature

How to exclude a field from a type?

@strawberry.type(name="File")
class FileType(DjangoFileType):
    path: strawberry.Private[str]

Current: The path field still shows up in the schema. Expected: No more path field exposed.

Upvote & Fund

Fund with Polar

brunodantas commented 2 weeks ago

Hmm that's already a feature. Is it not working for Django types?

https://play.strawberry.rocks/?gist=5a61a5784811fa8f38d67f259ecde617

patrick91 commented 2 weeks ago

@brunodantas I think the issue is with overriding another type's file (DjangoFileType in this case)