Import API schemas from openlibrary-client
JbIPS opened this issue · comments
Problem
I'm working on completing the openapi.json
schema with the /api/import
endport (following #9047 ) and as suggested, it would be interesting to use the schemas already publish by openlibrary-client.
Proposal & Constraints
It's pretty easy to import a schema with a $ref
keyword in Open API spec.
But JSON schema and Open API specs are not totally compatible, we should use a converter. The output should be added to /static
, close to openapi.json
and referenced in the spec.
The problem is: how and when should we pull the file from another repo, convert and expose them?
Leads
I see a potential flow like this:
- create a
package.json
script thatcurl
the schemas files and convert them - add a build step (maybe in CI) that update the schema at each commit
But the all thing feels upside down: the server fetch a schema from its client, meaning the API and the doc won't be in sync. Is there a possibility to migrate the schema in this repository, the server becoming the source of truth?