andreytreyt / yarp-swagger

It's an easy to use Swagger extension for the YARP project.
MIT License
63 stars 14 forks source link

Allow publishing API metadata #21

Closed justinsoderstrom closed 10 months ago

justinsoderstrom commented 10 months ago

Is your feature request related to a problem? Please describe.

The generated swagger documents don't copy the API metadata (OpenAPI info object) from the configured swagger specifications. Currently, the ConfigureSwaggerOptions.cs just set up a title and version via options.SwaggerDoc(cluster.Key, new OpenApiInfo {Title = cluster.Key, Version = cluster.Key});.

There is currently no way to copy metadata over into the generated swagger document without manually copying the information into the OpenApiInfo object. But this solution is error-prone as the YARP metadata will need to be manually updated every time there is a change to the swagger document.

Describe the solution you'd like

There should be an option in the appsettings.json file where you can specify which swagger path to use to copy over the metadata into the generated swagger document.

Describe alternatives you've considered

The only alternative right now would be to manually set up the OpenApiInfo object with all of the necessary metadata in the ConfigureSwaggerOptions file.

Additional context

Ultimately, I'm looking for a way to be able to copy over the (OpenAPI info object) into the YARP swagger without having to manually set it up.