示例#1
0
        public static void ConfigureSwagger(IAppBuilder app)
        {
            //var apiExplorer = HttpConfig.AddVersionedApiExplorer(o => o.GroupNameFormat = "'v'VVV");
            var apiExplorer = HttpConfig.AddODataApiExplorer(options =>
            {
                options.GroupNameFormat = "'v'VVV";
            });

            HttpConfig.EnableSwagger(
                "{apiVersion}/swagger",
                swagger =>
            {
                swagger.MultipleApiVersions(
                    (apiDescription, version) => apiDescription.GetGroupName() == version,
                    info =>
                {
                    foreach (var group in apiExplorer.ApiDescriptions)
                    {
                        var description = "eGate DataServices to Connect to eNVenta ERP.";

                        if (group.IsDeprecated)
                        {
                            description += " (Deprecated)";
                        }

                        info.Version(group.Name, $"eNVenta eGate DataServices API {group.ApiVersion}")
                        .Contact(c => c.Name("Nissen & Velten Software GmbH")
                                 .Email("*****@*****.**"))
                        .Description(description);
                    }
                });

                swagger.ResolveConflictingActions(apiDescriptions => apiDescriptions.First());

                swagger.OperationFilter <SwaggerDefaultValues>();

                //swagger.IncludeXmlComments(XmlCommentsFilePath);
            })
            .EnableSwaggerUi(swagger => swagger.EnableDiscoveryUrlSelector());
        }