Skip to content

Conversation

@freb
Copy link
Contributor

@freb freb commented May 1, 2025

Optional fields are fields not required for entity creation. However, unless those fields are also Nillable, querying the entity will always provide a value for optional fields. Nillable, not Optional, should determine which type fields are marked as required in the generated GraphQL schema.

freb added 7 commits April 30, 2025 21:25
Entity optional fields means the field is not required for entity
creation, but the field always has a value (the Go default when not
specified) when the entity is queried. Nillable, not optional should
be used to determine if a type's field is required.
@freb
Copy link
Contributor Author

freb commented May 2, 2025

I misunderstood how Optional() works. I didn't realize these fields were created as nullable in the database and that the gqlgen code receives the potentially null value and not the zero value as accessible from the generated ent type.

@freb freb closed this May 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant