-
-
Notifications
You must be signed in to change notification settings - Fork 5.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow more configuration in introspection to determine which types should be react-admin resources #4933
Comments
The solution is to build your own GraphQL dataProvider. Use the existing ones as starting points. |
Sure but the proposal is to make small changes to
|
@djhi I am trying to understand why the decision was made to make all resources implement both a GET_LIST and GET_ONE. I am thinking of porting over an existing admin site I have to use react admin and there are a couple of cases where a resource only has a GET_ONE. It seems like @bayareacoder's suggestion is a good one so I could easily overwrite the default behavior in these one-offs. Is there another workaround for this use case that I am missing? I understand that I could fix this by writing my own provider but I am happy with the rest of the functionality of |
Is your feature request related to a problem? Please describe.
To detect a GraphQL type as a resource, the current introspection requires that there is a query in the GraphQL API with a singular name of the resource AND a plural name. While you can set the operation names of these queries in an option, you cannot change the requirement that BOTH need to be present for a type to be detected as a resource due to this fixed function in
introspection.js
:Any whitelisting of resources via
include
is only applied infilterTypesByIncludeOrExclude
AFTER the above. This is a problem with APIs that do not support a plural or singular version of a query.Describe the solution you'd like
The
include
list should override any filtering done byisResource
Describe alternatives you've considered
You could pass in a completely custom
resolveIntrospection
to fix this, but seems overkillAdditional context
This goes together with issue#4932 to allow multiple GraphQL queries for a single react-admin verb. For instance, both changes are needed to support GraphQL APIs that support
GET_MANY
or eventGET_LIST
only from multipleGET_ONE
fetches (eg in case allid
s are known outside the API) as they would not have a plural query, and then require multiple queries to provide the data required forGET_LIST
orGET_MANY
The text was updated successfully, but these errors were encountered: