You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/ra-data-graphql/README.md
+110Lines changed: 110 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -199,6 +199,116 @@ The `./schema` file is a `schema.json` in `./src` retrieved with [get-graphql-sc
199
199
200
200
> Note: Importing the `schema.json` file will significantly increase the bundle size.
201
201
202
+
## Leveraging Introspection In Custom Methods
203
+
204
+
If you need to build custom methods based on the introspection, you can leverage the `getIntrospection` method of the `dataProvider`. It returns an object with the following format:
205
+
206
+
```js
207
+
{
208
+
// The original schema as returned by the Apollo client
209
+
schema: {},
210
+
// An array of object describing the types that are compatible with react-admin resources
211
+
// and the methods they support. Note that not all methods may be supported.
212
+
resources: [
213
+
{
214
+
type: { name:'name-of-the-type' }, // e.g. Post
215
+
GET_LIST: { name:'name-of-the-query' }, // e.g. allPosts
216
+
GET_MANY: { name:'name-of-the-query' }, // e.g. allPosts
217
+
GET_MANY_REFERENCE: { name:'name-of-the-query' }, // e.g. allPosts
218
+
GET_ONE: { name:'name-of-the-query' }, // e.g. Post
219
+
CREATE: { name:'name-of-the-query' }, // e.g. createPost
220
+
UPDATE: { name:'name-of-the-query' }, // e.g. updatePost
221
+
DELETE: { name:'name-of-the-query' }, // e.g. deletePost
222
+
},
223
+
],
224
+
}
225
+
```
226
+
227
+
This is useful if you need to support custom dataProvider methods such as those needed for ['@react-admin/ra-realtime'](https://react-admin-ee.marmelab.com/documentation/ra-realtime#dataprovider-requirements):
0 commit comments