Understand GraphQL Schema Requirements

The Salesforce Connect adapter for GraphQL requires that the GraphQL schema adhere to a specific format. This representative schema is designed for you to understand how to construct a schema that works with Salesforce Connect.

1//Represents the pattern to follow for each object; ObjName denotes the name of a GraphQL object
2
3type Query {
4    objName(
5        limit: Int,
6        offset: Int,
7        orderBy: [ObjName_OrderByInput],
8        where: ObjName_FilterInput,
9        first: Int,
10        after: String
11    ): ObjName_Connection
12        <additional object queries...>
13        node(id: ID!): Node
14}
15
16type Mutation {
17    create_ObjName(input: ObjName_CreateInput!): ObjName
18    <additional create mutations>
19    ...
20    delete_ObjName(id: ID!): ObjName
21    <additional delete mutations>
22    ...
23    update_ObjName(input: ObjName_UpdateInput!): ObjName
24    <additional update mutations>
25    ...
26}
27
28type ObjName implements Node {
29    id: ID!
30    <fieldName: fieldType>
31    ...
32}
33
34type ObjName_Connection {
35    edges: [ObjName_Edge]
36    pageInfo: PageInfo!
37}
38
39input ObjName_CreateInput {
40        <fieldName: fieldType>
41        ...
42}
43
44input ObjName_UpdateInput {
45    id: ID!
46    <fieldName: fieldType>
47    ...
48}
49
50type ObjName_Edge {
51    cursor: String!
52    node: ObjName
53}
54
55input ObjName_FilterInput {
56    and: [ObjName_FilterInput]
57    not: ObjName_FilterInput
58    or: [ObjName_FilterInput]
59    id: IDOperator
60    <fieldName: fieldTypeOperator>
61    ...
62}
63
64input ObjName_OrderByInput {
65    id: OrderByClause
66    <fieldName >: OrderByClause
67    ...
68}
69
70//Represents common code, not specific to the objects
71
72interface Node {
73    id: ID!
74}
75
76enum NullsOrder {
77    NULLS_FIRST
78    NULLS_LAST
79}
80
81input OrderByClause {
82    direction: Direction
83    nulls: NullsOrder
84}
85
86type PageInfo {
87    endCursor: String
88    hasNextPage: Boolean!
89    hasPreviousPage: Boolean!
90    startCursor: String
91}
92
93input StringOperator {
94    eq: String
95    gt: String
96    ge: String
97    in: [String]
98    like: String
99    lt: String
100    le: String
101    ne: String
102    nin: [String]
103}
104
105input AWSDateOperator {
106    eq: AWSDate
107    gt: AWSDate
108    ge: AWSDate
109    in: [AWSDate]
110    like: AWSDate
111    lt: AWSDate
112    le: AWSDate
113    ne: AWSDate
114    nin: [AWSDate]
115}
116
117input AWSDateTimeOperator {
118    eq: AWSDateTime
119    gt: AWSDateTime
120    ge: AWSDateTime
121    in: [AWSDateTime]
122    like: AWSDateTime
123    lt: AWSDateTime
124    le: AWSDateTime
125    ne: AWSDateTime
126    nin: [AWSDateTime]
127}
128
129input AWSJSONOperator {
130    eq: AWSJSON
131    gt: AWSJSON
132    ge: AWSJSON
133    in: [AWSJSON]
134    like: AWSJSON
135    lt: AWSJSON
136    le: AWSJSON
137    ne: AWSJSON
138    nin: [AWSJSON]
139}
140
141input AWSTimeOperator {
142    eq: AWSTime
143    gt: AWSTime
144    ge: AWSTime
145    in: [AWSTime]
146    like: AWSTime
147    lt: AWSTime
148    le: AWSTime
149    ne: AWSTime
150    nin: [AWSTime]
151}
152
153input BooleanOperator {
154    eq: Boolean
155    gt: Boolean
156    gebolded: Boolean
157    in: [Boolean]
158    like: Boolean
159    lt: Boolean
160    le: Boolean
161    ne: Boolean
162    nin: [Boolean]
163}
164
165enum Direction {
166    ASC
167    DESC
168}
169
170input FloatOperator {
171    eq: Float
172    gt: Float
173    ge: Float
174    in: [Float]
175    like: Float
176    lt: Float
177    le: Float
178    ne: Float
179    nin: [Float]
180}
181
182input IDOperator {
183    eq: ID
184    gt: ID
185    ge: ID
186    in: [ID]
187    like: ID
188    lt: ID
189    le: ID
190    ne: ID
191    nin: [ID]
192}
193
194input IntOperator {
195    eq: Int
196    gt: Int
197    ge: Int
198    in: [Int]
199    like: Int
200    lt: Int
201    le: Int
202    ne: Int
203    nin: [Int]
204}

DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!