Skip to content
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

API schema is undefined React Admin with Hydra problem with introspect #525

Open
KlaudiaBrzywcy opened this issue Feb 14, 2024 · 1 comment

Comments

@KlaudiaBrzywcy
Copy link

We recently decided to use React Admin with API Platform for our internal app. React Admin linked your repo in their documentation, with a comment that this is a suitable dataProvider for our set up. Unfortunately, it doesn’t work as we hoped, and I wonder why.

Let me guide you through our case.
We have configured React admin with Next.js (v 13.4.19) with Hydra (JSON-LD) as the backend.

  1. At first, we implemented dataProvider as it is, regarding to the repo linked in the documentation:
    https://github.com/api-platform/admin/blob/main/src/hydra/dataProvider.ts
    but we were not able to display the API data at all, with the error as on the screen nr 1
nr 1
  1. Then mostly for debugging purposes, we have added a hacky solution in the code to make apiSchema optional: screen nr 2 and we were able to display some data and even create some views as usersList, singleUser, userEdit but not everything worked as one might expect. Check out the chips fields it remains empty: screen nr 3.
nr 2 nr 3
  1. Then we tried to edit the user in edit view: screen 4
nr 4
  1. After the editing for few seconds you can see the changes on usersList, even the chips fields work: screen 5
nr 5
  1. And then it all disappears with an error message: screen 6
nr 6

From what we have observed, there is an introspection issue and apiSchema returns an undefined value when we try to log it.

@PawelSuwinski
Copy link
Contributor

PawelSuwinski commented Mar 19, 2024

apiSchema is not optional, admin needs to get it correctly parsed, first of all try to check if it works:
https://github.com/api-platform/api-doc-parser?tab=readme-ov-file#usage

If not fix generated docs jsonld document or pass custom (ex. proxied) instance of parser to HydraAdmin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants