I have swagger configured in my solution and it is showing up the API documentation properly. Now recently I have developed some new APIs in the same solution and these are also showing up in API documentation and these projects also follow the same naming conventions. Now my requirement is I want to segregate the new API documentation from the older ones so basically I want two JSON files generated one foe each, old API, AND new API.
My Swagger configuration looks like the following.
Config.EnableSwagger(@"api-docs/{apiVersion}",
c =>
{
c.SingleApiVersion("v1", "SAMPLE API");
c.UseFullTypeNameInSchemaIds();
c.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());
foreach (String x in Directory.GetFiles(Path.GetDirectoryName(Uri.UnescapeDataString(new UriBuilder(Assembly.GetExecutingAssembly().CodeBase).Path)), "*.dll")
.Where(f => Path.GetFileNameWithoutExtension(f).ToLower().Contains("sample") ****&& !Path.GetFileNameWithoutExtension(f).ToLower().Contains("sample.api"))****
.Select(f => String.Format(@"{0}\{1}.xml", Path.GetDirectoryName(f), Path.GetFileNameWithoutExtension(f)))
.Where(File.Exists))
{
c.IncludeXmlComments(x);
}
c.OperationFilter<AddRequiredHeaderParameter>();
});
My New API projects are named sample.api.test and old API projects are named sample.web.test. I added the && part in the where clause to ignore picking my new files in the first JSON doc generation but of no luck. I am new to this and really don't know if it is possible to have two JSON depending on project names. Any help would be greatly appreciated.