-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Background
I'm using spring-graphql with strict input types like UserInput, PolicyRuleInput, etc. On the frontend, we often add extra fields to objects for local state tracking (e.g., timestamp
, __typename
), which are not part of the schema.
When we submit a mutation like saveUser, it fails with:
Validation error ... contains a field not in 'UserInput': 'timestamp'
Feature Request
It would be helpful to have an option that allows unknown fields in the input to be ignored during validation, or be stripped before binding. For example:
graphql:
validation:
ignore-extra-fields: true
Rationale
This aligns with practical frontend workflows (especially in Apollo), where local fields are used for caching and UI state.
Alternative
Right now, we manually strip fields like __typename
, timestamp
, etc., before submitting mutations. But this is error-prone and repetitive.
Related Discussions
- GraphQL spec strictly disallows unknown fields, but some GraphQL servers (like GraphQL Yoga) provide an "ignore unknown fields" mode.
- Could this be made optional behind a config or annotation?