-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Description
The initial section on how to modify the parsed API doc shown below appears to be invalid…
const apiDocumentationParser = entrypoint => parseHydraDocumentation(entrypoint)
.then(api => {
api.resources.map(resource => {
const books = api.resources.find(r => 'books' === r.name);
books.fields.find(f => 'description' === f.name).fieldComponent = <RichTextField source="description" key="description"/>;
books.fields.find(f => 'description' === f.name).inputComponent = <RichTextInput source="description" key="description"/>;
return resource;
});
return api;
})
;
This appears to loop through the array (using map
), but then attempts to find the books (using find
). Should this be one or other?
Also, in my setup it seams that the api
variable has a child called api
which contains resources
rather than resources
being a direct child of the api
argument passed in.
Happy to submit a PR if this is correct?…
const apiDocumentationParser = entrypoint => parseHydraDocumentation(entrypoint)
.then(api => {
const books = api.api.resources.find(r => 'books' === r.name);
books.fields.find(f => 'description' === f.name).fieldComponent = <RichTextField source="description" key="description"/>;
books.fields.find(f => 'description' === f.name).inputComponent = <RichTextInput source="description" key="description"/>;
return api;
})
;
Also, when I use the parseHydraDocumentation() I receive the following error. Any idea why?…
index.js:2177 Warning: Failed prop type: Invalid prop `api` of type `Api` supplied to `_class`, expected instance of `Api`.
in _class (created by HydraAdmin)
in HydraAdmin (at Admin.js:33)
in Admin (at App.js:5)
in Unknown (at index.js:7)
… It looks like the API object it's returning doesn't match the expected API class object for some reason.
Metadata
Metadata
Assignees
Labels
No labels