Skip to content

Conversation

@cervengoc
Copy link

@cervengoc cervengoc commented Mar 28, 2018

With this PR it's possible to use the generator outside of the WebAPI pipeline using the same configuration without needing to manually set up the generator and the options.

This is needed to ensure that for example a unit test is using the exact same configuraiton as the Web API at runtime.

An example pseudo-code from a possible unit test

var config = new SwaggerDocsConfig();
var httpConfig = new HttpConfiguration();
WebApiStartup.ConfigureApi(httpConfig); // this is called by the API pipeline too
WebApiStartup.ConfigureSwagger(config);
var generator = config.GetSwaggerProvider(httpConfig);
var document = generator.Generate....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant