Jarvis
Jarvis copied to clipboard
Add support for Swagger UI
Swagger UI is a free library used for API documentation. The use of it is so wide spread it can be considered industry standard. In C# the library is available as a nuget package that can be installed and configured for each individual project. https://learn.microsoft.com/en-us/aspnet/core/tutorials/web-api-help-pages-using-swagger?view=aspnetcore-7.0 It would be nice if this was available in Jarvis as well, preferably by default.
Hi Gheorghe,
We'd like to better understand what you envision with Jarvis and SwaggerUI. From what we can tell, it seems the steps are: • Define an API using OpenAPI in a json or yaml file. • Make it viewable using SwaggerUI as a set of HTML/CSS/JavaScript files. • Enable Jarvis to serve that content up through its HTML interface. It would still be up to the developer to write all the code in Jarvis to actually service the requests.
Is that along the lines of what you were envisioning? Or did you have something else in mind?
If that's what you had envisioned, then I think we just need to enable the HTML interface in REST mode. In fact, it wouldn't matter whether the content was generated by SwaggerUI or any other tool as Jarvis doesn't need any special knowledge of the source of the HTML/CSS/JS.
I think that would definitely be a possible solution. The outcome would be to use the SwaggerUI interface as a test tool while developing an APL based webservice in Jarvis.
- as a developer I would expect to write all the code pertaining to the request/response cycle
- the swagger interface would update dynamically as I make changes to the signature of an endpoint exposed via swagger
- ideally there would be a simple way to toggle the swagger interface depending on the type of environment the api is running in (it should never be turned on in a production environment) - it could be achieved via an environment variable or via a config file.
Overall I think we are aligned about the outcome - but do let me know if anything is unclear.