The react-admin homepage prominently shows an OpenAPI (formerly Swagger) logo, but I can't find the relevant Data Provider in the list or on GitHub. Is it best to use ra-data-simple-rest
and extend it, or am I missing something and is there a ready-made adapter that parses an OpenAPI spec file?
OpenAPI support in react-admin?
Asked Answered
I was similarly confused and couldn't find any adapter or data provider for the same. Ended up writing my own data provider and figured out it was a breeze. The main point to note here is that it'll be different for every OpenAPI spec, based on the way the APIs are designed. Using the swagger-client
makes it as simple as
client.execute({
method: 'get',
parameters: { ...params },
pathName: `/${resource}`,
})
for the getList
method.
As said by alanpoulain on this github issue, you can have a look at https://github.com/api-platform/admin.
It's Hydra by default, but since it's based on https://github.com/api-platform/api-doc-parser, having an OpenAPI support should be doable.
Please let us know if you get it working !
© 2022 - 2024 — McMap. All rights reserved.