OpenAPI support in react-admin?
Asked Answered
P

2

7

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?

Prothalamium answered 21/1, 2020 at 8:41 Comment(0)
S
2

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.

Shanaeshanahan answered 6/5, 2020 at 8:49 Comment(0)
P
1

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 !

Pity answered 6/6, 2020 at 18:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.