The GraphQL schema ra-graphql-data-simple expects and the one that json-graphql-server generates are different. The README says otherwhise.
What you were expecting:
I was expecting that ra-graphql-data-simple would accept the GraphQL schema generated by marmelab/json-graphql-server as is stated in the README
What happened instead:
The schema ra-graphql-data-simple expects and the schema that json-graphql-server generates are different.
The problem seems to be the "remove/delete" operation:
- react-admin expects:
deletePost(id: ID!): Post - json-graphql-server generates:
removePost(id: ID!): Boolean
Related code:
-
The README of
ra-graphql-data-simplewhere it shows the expected schema. -
The README of
json-graphql-serverwhere it shows the generated schema. -
The code of
ra-graphql-data-simplethat confirms that it expectsdeleteResourceas the default name for the DELETE operation. Also, it seems it only returns the id as the response, and not the whole object. The test confirms all this. -
The code of
json-graphql-serverthat confirms that it is generated asremoveResource. And the test that confirms it.
Other information:
This issue seems related : https://github.com/marmelab/react-admin/issues/2663
Environment
- react-admin version: 3.2.0
- json-graphql-server version: 2.1.3
Confirmed, thanks for the details issue!
Be aware that there are more incongruences between what ra-graphql-data-simple expects and what json-graphql-server generates.
I realised it afterwards but did not update this issue due to the lack of interest on it. If somebody is interested on fixing not only the README but the schema let me know and I'll try to point the rest of them them out too.
did you have some updates on it?
I'm not sure how we should handle this. It would be a breaking change for one of the two packages. Maybe we could add the deleteXXX method to json-graphql-server, without removing the old removeXXX?
Done in marmelab/json-graphql-server#190
Released in https://github.com/marmelab/json-graphql-server/releases/tag/v3.2.0