strawberry-graphql / strawberry.rocks

Website for Strawberry GraphQL
https://strawberry.rocks
MIT License
26 stars 13 forks source link

Private fields not private in Python 3.12 #485

Closed rsr5 closed 8 months ago

rsr5 commented 8 months ago

Describe the Bug

Private fields not private in Python 3.12. I reproduced with the following code:

import strawberry

@strawberry.type
class User:
    name: str
    age: int
    secret: str = strawberry.Private[str]

@strawberry.type
class Query:
    @strawberry.field
    def user(self) -> User:
        return User(name="Patrick", age=100, secret="can't tell")

schema = strawberry.Schema(query=Query)

and I see the following at http://0.0.0.0:8000/graphql:

image

System Information