Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make option creation and provider creation public and more generic #1229

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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