api-platform / api-doc-parser

Transforms a Hydra API doc in an intermediate representation that can be used for various tasks such as creating smart API clients, scaffolding code or building administration interfaces.
MIT License
104 stars 71 forks source link

Extend OpenAPI3 support #94

Closed simonhildebrandt closed 2 years ago

simonhildebrandt commented 3 years ago
Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? ?
Tickets fixes #37
License MIT
Doc PR api-platform/docs#...

To get API Platform's Admin working in my project I needed OpenAPI3 support; the current parsing code didn't work for me so I've been experimentally writing some that lines up a bit closer with the [https://swagger.io/specification/](OpenAPI3 spec).

I've tried to document my assumptions - the OpenAPI3 doesn't really represent 'resources', exactly, so there's quite a bit of translation involved. I pulled in an external library to deal with the '$ref' mechanism used in the spec; I've also added some field attributes like 'embedded' that the Admin code seemed to need.

I haven't yet explored types etc much - this PR is mainly to test the waters on my approach, and the receptivity of the team for this kind of change.

Thanks for the library. :)

PS. I added 'lib' to the tsconfig.json 'cause I was getting warnings about overwriting the type files. I'm not very experienced with TypeScript but this seemed to fix the problem.

alanpoulain commented 3 years ago

Hello. Thank you for working on this. It was in my TODO list :wink:

alanpoulain commented 2 years ago

Superseded by https://github.com/api-platform/api-doc-parser/pull/108, thank you very much @simonhildebrandt!