Skip to content

Commit 3edac4f

Browse files
committed
Move troubleshooting to its own file so as not to overload the main README.
1 parent e2c176b commit 3edac4f

File tree

2 files changed

+30
-30
lines changed

2 files changed

+30
-30
lines changed

README.md

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ Reference the Bootstrap CSS stylesheet in `public/index.html` (optional):
4848

4949
In the app directory, generate the files for the resource you want:
5050

51-
$ api-platform-generate-crud https://demo.api-platform.com/index.jsonld src/ --resource foo
51+
$ api-platform-generate-crud https://demo.api-platform.com src/ --resource foo
5252
# Replace the URL by the entrypoint of your Hydra-enabled API
5353
# Omit the resource flag to generate files for all resource types exposed by the API
5454

@@ -89,34 +89,6 @@ ReactDom.render(
8989
);
9090
```
9191

92-
## Troubleshooting
93-
* The generator does not perform any authentication, so you must ensure that all referenced hydra paths for your API are accessible anonymously. If you are using [API Platform](https://api-platform.com) this will at least include:
94-
```
95-
api_entrypoint ANY ANY ANY /{index}.{_format}
96-
api_doc ANY ANY ANY /docs.{_format}
97-
api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format}
98-
```
99-
100-
* If you recieve `Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist.` you may have specified the documentation URL instead of the entrypoint. For example if you are using [API Platform](https://api-platform.com) and your documentation URL is at https://demo.api-platform.com/docs the entry point is likely at https://demo.api-platform.com/index.jsonld.
101-
102-
* If you receive `TypeError: Cannot read property '@type' of undefined` or `TypeError: Cannot read property '0' of undefined` check that the URL you specified is accessible and returns jsonld. You can check from the command line you are using by running something like `curl https://demo.api-platform.com/`.
103-
104-
* If you receive a message like this:
105-
```
106-
{ Error
107-
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
108-
at <anonymous>
109-
at process._tickCallback (internal/process/next_tick.js:188:7)
110-
name: 'jsonld.InvalidUrl',
111-
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
112-
details:
113-
{ code: 'invalid remote context',
114-
url: 'https://demo.api-platform.com/contexts/Entrypoint',
115-
cause: null } }
116-
```
117-
118-
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied" message in JSON format was being returned.
119-
12092
## TODO
12193

12294
* Add support for pagination
@@ -131,4 +103,4 @@ Check access to the specified url, in this case `https://demo.api-platform.com/c
131103

132104
## Credits
133105

134-
Created by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).
106+
Created by [Kévin Dunglas](https://dunglas.fr). Sponsored by [Les-Tilleuls.coop](https://les-tilleuls.coop).

Troubleshooting.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
# Troubleshooting
3+
* The generator does not perform any authentication, so you must ensure that all referenced hydra paths for your API are accessible anonymously. If you are using [API Platform](https://api-platform.com) this will at least include:
4+
```
5+
api_entrypoint ANY ANY ANY /{index}.{_format}
6+
api_doc ANY ANY ANY /docs.{_format}
7+
api_jsonld_context ANY ANY ANY /contexts/{shortName}.{_format}
8+
```
9+
10+
* If you recieve `Error: The class http://www.w3.org/ns/hydra/core#ApiDocumentation doesn't exist.` you may have specified the documentation URL instead of the entrypoint. For example if you are using [API Platform](https://api-platform.com) and your documentation URL is at [https://demo.api-platform.com/docs] the entry point is likely at [https://demo.api-platform.com]. You can see an example of the expected response from an entrypoint in your browser by clicking visiting [https://demo.api-platform.com/index.jsonld].
11+
12+
* If you receive `TypeError: Cannot read property '@type' of undefined` or `TypeError: Cannot read property '0' of undefined` check that the URL you specified is accessible and returns jsonld. You can check from the command line you are using by running something like `curl https://demo.api-platform.com/`.
13+
14+
* If you receive a message like this:
15+
```
16+
{ Error
17+
at done (/usr/local/share/.config/yarn/global/node_modules/jsonld/js/jsonld.js:6851:19)
18+
at <anonymous>
19+
at process._tickCallback (internal/process/next_tick.js:188:7)
20+
name: 'jsonld.InvalidUrl',
21+
message: 'Dereferencing a URL did not result in a JSON object. The response was valid JSON, but it was not a JSON object.',
22+
details:
23+
{ code: 'invalid remote context',
24+
url: 'https://demo.api-platform.com/contexts/Entrypoint',
25+
cause: null } }
26+
```
27+
28+
Check access to the specified url, in this case `https://demo.api-platform.com/contexts/Entrypoint`, use curl to check access and the response `curl https://demo.api-platform.com/contexts/Entrypoint`. In the above case an "Access Denied" message in JSON format was being returned.

0 commit comments

Comments
 (0)