6

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?

Niek
  • 1,709
  • 2
  • 11
  • 10

2 Answers2

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.

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 !

Olivier
  • 11
  • 1