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

Error: The class "http://www.w3.org/ns/hydra/core#ApiDocumentation" is not defined in the API documentation. #3158

Closed
jandrell-formoso opened this issue Oct 7, 2019 · 5 comments

Comments

@jandrell-formoso
Copy link

Hi. I tried using the client-generator repository to use hydra api in a react native project. I followed the steps in the docs and changed the demo api to our own api which uses Symfony 4 with @api-platform/admin. This is the error that I get after running the command.

npx @api-platform/client-generator {{api docs url}} output/ --resource User --generator react-native

This is the result:

Error: The class "http://www.w3.org/ns/hydra/core#ApiDocumentation" is not defined in the API documentation.
    at findSupportedClass (/Users/jandrell/.npm/_npx/49065/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/hydra/parseH
ydraDocumentation.js:80:9)
    at /Users/jandrell/.npm/_npx/49065/lib/node_modules/@api-platform/client-generator/node_modules/@api-platform/api-doc-parser/lib/hydra/parseHydraDocumentation.js
:255:27
    at process._tickCallback (internal/process/next_tick.js:68:7)
@teohhanhui
Copy link
Contributor

I suspect you're using the wrong URL for the entrypoint.

@teohhanhui
Copy link
Contributor

You should not use /docs but /

@jandrell-formoso
Copy link
Author

@teohhanhui I see. I tried removing the /docs part but I'm getting a 401 error. Do this have an ability to include a token somewhere before generating the code?

@dunglas
Copy link
Member

dunglas commented Oct 14, 2019

@jandrell-formoso not yet, you have to edit the code generated in dataAccess.js to put your authentication logic. Adding an option to the client generator to support authentification would be nice btw. See api-platform/create-client#172.

@lud
Copy link

lud commented Dec 8, 2020

Hello, I have the same problem with the api-doc-parser client. The problem is that route / is handled by a DefaultController that returns basically nothing… What other route is available to be used by the parser?

Edit: Nevermind, the project I have inherited has the api-platform mounted on an url prefix.

Thank you

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

4 participants