ballerina-platform / ballerina-library

The Ballerina Library
https://ballerina.io/learn/api-docs/ballerina/
Apache License 2.0
136 stars 58 forks source link

Add Support for Custom Root Operation Type Names in GraphQL #4177

Open chathuranga-jayanath-99 opened 1 year ago

chathuranga-jayanath-99 commented 1 year ago

Description: GraphQL schema can be represented in following 2 methods,

Method 1

type Query {
    someField: String
}

Method 2

schema {
    query: MyQueryRootType
}

type MyQueryRootType {
    someField: String
}

Method 2 is need to be considered when sending introspection queries. Currently the implementation doesn't check this.

ThisaruGuruge commented 1 year ago

In the second approach, the root query operation type has a different name. The only difference here is when introspecting, the type name would be different. This can be achieved if we allow to define separate service types for root operations. Might be related to #1382 and more precisely, providing a way to define GraphQL schema/service separately from the HTTP listener.

ThisaruGuruge commented 1 year ago

Related to #4620