clarin-eric / VirtualCollectionRegistry

Virtual Collection Registry (VCR)
GNU General Public License v3.0
2 stars 0 forks source link

Add swagger / Open API support to document REST API #110

Open WillemElbers opened 3 years ago

WillemElbers commented 3 years ago

As suggested by John Shepherdson, via mail on 14 October 2020, add Add swagger / Open API support to document REST API. See https://swagger.io/docs/specification/about/

WillemElbers commented 3 years ago

Released in https://github.com/clarin-eric/VirtualCollectionRegistry/releases/tag/1.6.0-rc1

zozlak commented 3 years ago

Two questions/concerns regarding the Open API:

WillemElbers commented 3 years ago

I will update the deployment to only include the /dist folder.

Currently we are not hosting the Swagger UI as a central service. However, if there are more services than can get use out of it, we can consider this.

WillemElbers commented 3 years ago

The JSON File link is provided just below the title (it is a bit hidden): https://collections.clarin.eu/swagger.json

zozlak commented 3 years ago

Thanks for the link.

I have a few more questions though:

WillemElbers commented 3 years ago

CORS has been enabled on the swagger.json file and other API endpoints under /server/* for the beta instance. Interaction via https://petstore.swagger.io/ is working now. This will be deployed in production with the next release.

I will add a reference to the swagger.json file to the help page.

WillemElbers commented 3 years ago

Authorization via API keys (can be generated in the user profile page) is available via the Open API documentation.

We may add the submission endpoint to the Open API documentation at some later point in time.

zozlak commented 3 years ago

Authorization via API keys (can be generated in the user profile page) is available via the Open API documentation.

Sorry, I missed it.

We may add the submission endpoint to the Open API documentation at some later point in time.

This would be nice as the it is possible to automatically generate client code stubs in various languages from the Open API-compatible API specification (e.g. go to https://app.swaggerhub.com/apis/zozlak/arche/2.0 and click on export->client SDK in the upper-right corner) and this would allow an extremely straightforward integration with the service.