Closed
Description
I did not find answers to these questions in the spec: http://facebook.github.io/graphql/
In this I want to set some details.
The question concerns all types that allow the use of inheritance in the following cases:
type Object implements Interface {...}
type Object {...} extend Object {...}
Extending the number of arguments
# section-1
interface Interface {
field: String
}
# section-2
type Object implements Interface {
field(arg1: String): String
}
# section-3
extend type Object {
field(arg2: String): String
}
- Is it possible to expand the number of arguments during the interface implementation (section-2)? Or should there be an error?
- Is it possible to expand the number of arguments during a type extension (section-3)? Or should there be an error?
2.1) Extend complements field arguments? (The result looks like:field (arg1: String, arg2: String): String
)
2.2) Does the extension redefine the field arguments? (The result looks like:field (arg2: String): String
)
It seems to me that the answers are the following (please correct):
- Yes
- Yes
2.1) Yes
2.2) No
Overriding of Container Types
The question concerns types NonNull and List.
# section-1
interface Interface {
field(arg1: String): String
}
# section-2
type Object implements Interface {
field(arg1: String!): String!
}
The table of allowed overrides ("container type-cast coercion") looks like this (correct, if I'm wrong):
Tags:
:ok:
- Allowed❌
- Not allowed?
- I do not know
Definition | Implementation | Is acceptable? |
---|---|---|
Type |
Type! |
🆗 |
Type |
[Type] |
❌ |
Type |
[Type!] |
❌ |
Type |
[Type]! |
❌ |
Type |
[Type!]! |
❌ |
------------ | ---------------- | ---------------- |
Type! |
Type |
❌ |
Type! |
[Type] |
❌ |
Type! |
[Type!] |
❌ |
Type! |
[Type]! |
❌ |
Type! |
[Type!]! |
❌ |
------------ | ---------------- | ---------------- |
[Type] |
Type |
❌ |
[Type] |
Type! |
❌ |
[Type] |
[Type!] |
🆗 |
[Type] |
[Type]! |
🆗 |
[Type] |
[Type!]! |
🆗 |
------------ | ---------------- | ---------------- |
[Type!] |
Type |
❌ |
[Type!] |
Type! |
❌ |
[Type!] |
[Type] |
❌ |
[Type!] |
[Type]! |
❌ |
[Type!] |
[Type!]! |
🆗 |
------------ | ---------------- | ---------------- |
[Type]! |
Type |
❌ |
[Type]! |
Type! |
❌ |
[Type]! |
[Type] |
❌ |
[Type]! |
[Type!] |
❌ |
[Type]! |
[Type!]! |
🆗 |
------------ | ---------------- | ---------------- |
[Type!]! |
Type |
❌ |
[Type!]! |
Type! |
❌ |
[Type!]! |
[Type] |
❌ |
[Type!]! |
[Type!] |
❌ |
[Type!]! |
[Type]! |
❌ |
Overriding of Scalar Types
The question concerns the rules for converting scalar types during inheritance.
Example code:
# section-1
interface Interface {
field: Int
}
# section-2
type Object implements Interface {
field: Float
}
- Are these type conversions permissible?
- The table of allowed overrides ("scalar type-cast coercion") I can't imagine how it should look like :D
@leebyron I will be glad to receive help in answering these questions. Excuse me if I missed some nuances from the specification document =)))
Metadata
Metadata
Assignees
Labels
No labels