- 
                Notifications
    You must be signed in to change notification settings 
- Fork 46
Open
Description
With the code below
from pydantic import StringConstraints
UnionId = Annotated[str, StringConstraints(min_length=28, max_length=28)]
class UserModel(BaseModel):
    id: str
    avatar: str | None = None
    unionid: UnionId | None = None
    unionid1: UnionId
class UserType(PydanticObjectType):
    class Meta:
        model = UserModel
The field unionid is incorrectly generated as a list of string in the schema:
type UserType {
  id: String!
  avatar: String
  unionid: [String]
  unionid1: String!
}
Note that the required version of the same UnionId type is generated correctly as in unionid1. Also, an unannotated optional string is also correct, as in field avatar.
My environment:
graphene                3.4.3
graphene-pydantic       0.6.1
python  3.13.5
Metadata
Metadata
Assignees
Labels
No labels