graphql / graphql/graphql-spec
Default value compatibility validation is only specified for Object field arguments
- Dominant language
- JavaScript
- Stars
- 14.6k
- Forks
- 1.2k
- PR merge metrics
- No merged PRs in 30d
Description
[PR #793](https://github.com/graphql/graphql-spec/pull/793) (Default value validation & coercion, September 2025 edition) added this rule to **Objects → Type Validation**:
> 5\. If the argument has a default value it must be compatible with {argumentType} as per the coercion rules for that type.
However, the parallel rule is absent from the other locations where default values can be defined:
- **Interfaces → Type Validation**: interface field arguments have no default-value compatibility rule (the argument rule list ends at `IsInputType`).
- **Input Objects → Type Validation**: input fields have no compatibility rule for their default values (the section did gain the `InputObjectDefaultValueHasCycle` rule, but nothing requiring the default itself to be compatible with the field type).
- **Type System Directives → Type Validation**: directive definition arguments have no default-value compatibility rule.
The reference implementation validates all four locations: [graphql-js#3814](https://github.com/graphql/graphql-js/pull/3814) calls `validateDefaultValue` from `validateFields` (which runs for both Object and Interface types), `validateInputFields`, and `validateDirectives` — and removed a `// TODO: validate default values?` marker in the interface-implementation checks.
If the omission is unintentional, the fix seems editorial: add the same bullet to the Interfaces, Input Objects, and Type System Directives validation sections.
_Drafted by Claude (Anthropic AI assistant)._
Contributor guide
Research direction
Start with the Interfaces, Input Objects, and Type System Directives Type Validation sections named in the issue, then compare the corresponding validation behavior described in graphql-js#3814. Done means each listed location specifies that a default value must be compatible with its type according to the coercion rules.
Written by the indexing model from the issue text.
Assessment
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 78/100