You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Adrian Kozma (Jira)" <ji...@apache.org> on 2020/10/13 14:26:00 UTC
[jira] [Commented] (SLING-9819) Add support for using Interface
type
[ https://issues.apache.org/jira/browse/SLING-9819?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17213141#comment-17213141 ]
Adrian Kozma commented on SLING-9819:
-------------------------------------
PR https://github.com/apache/sling-org-apache-sling-graphql-core/pull/11
> Add support for using Interface type
> ------------------------------------
>
> Key: SLING-9819
> URL: https://issues.apache.org/jira/browse/SLING-9819
> Project: Sling
> Issue Type: New Feature
> Components: GraphQL
> Affects Versions: GraphQL Core 0.0.8
> Reporter: Adrian Kozma
> Priority: Major
>
> (i) The current implementation of *sling-org-apache-sling-graphql-core* is not supporting the *Interface* type, however there's a way to implement it.
> The basis for supporting type resolvers has been already added by [0]
> The support for *Interface* types could be added by extending the buildWiring() method [1] adding the wiring for `InterfaceTypeDefinition.class` definitions as well.
>
> Schema definition supporting Interface types:
> {code:java}
> # This directive to maps types
> directive @resolver(
> name : String,
> options : String = "",
> source : String = ""
> ) on UNION | INTERFACE
> # GraphQL Schema used for our tests
> type Query {
> # Test union query
> unionQuery: CharactersAsUnion @fetcher(name:"character/fetcher")
> # Test interface query
> interfaceQuery: CharactersAsInterface @fetcher(name:"character/fetcher")
> }
> interface CharacterInterface @resolver(name:"character/resolver" source:"CharacterInterface") {
> id: ID!
> }
> union CharacterUnion @resolver(name:"character/resolver" source:"CharacterUnion") = Human | Droid
> type CharactersAsUnion {
> items: [CharacterUnion]
> }
> type CharactersAsInterface {
> items: [CharacterInterface]
> }{code}
>
>
> [0] https://issues.apache.org/jira/browse/SLING-9796
> [1] [https://github.com/apache/sling-org-apache-sling-graphql-core/blob/master/src/main/java/org/apache/sling/graphql/core/engine/DefaultQueryExecutor.java#L169]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)