At a glance
- Identifier: #445
- Stage: RFC 3 / Accepted
- Champion: @spawnia
- Latest activity: Spec PR closed on 2020-03-24
- Spec PR: https://github.com/graphql/graphql-spec/pull/445
Spec PR description
This was already discussed in Issue #189
Input Objects are allowed to reference other Input Objects. A circular reference occurs when an Input Object references itself either directly or through subordinated Input Objects.
Circular references are generally allowed, however they may not be defined as an unbroken chain of Non-Null fields. Such Input Objects are invalid, because there is no way to provide a legal value for them.
The following examples are allowed:
input Example {
self: Example
value: String
}
This is fine because a value for self may simply be omitted from the arguments.
input Example {
self: [Example!]!
value: String
}
This also works as self can just contain an empty list.
The following examples are invalid:
input Example {
value: String
self: Example!
}
input First {
second: Second!
value: String
}
input Second {
first: First!
value: String
}
The following example shows why no possible value can be provided:
{
someField(input: {
value: "val"
# self is required
self: {
value: "nextval"
# self is still required
self: {
# We would have to recurse down infinitely
...
}
}
})
}
Timeline
March 2020
- Spec PR closed on 2020-03-24
February 2020
- Advanced to RFC 3 on 2020-02-06 by leebyron
November 2019
October 2019
- Top comment edited on 2019-10-10 by spawnia
- Added to WG agenda on 2019-10-10
- Mentioned in WG notes on 2019-10-10
- Marked as Ready for Next Stage on 2019-10-09 by IvanGoncharov
June 2019
- Top comment edited on 2019-06-10 by spawnia
October 2018
- Advanced to RFC 2 on 2018-10-02 by leebyron
May 2018
- Spec PR created on 2018-05-16 by spawnia
- Top comment edited on 2018-05-16 by spawnia