REST
This commit is contained in:
@@ -26,24 +26,25 @@ Public Class SwaggerConfig
|
||||
Dim commentsFileName = Assembly.GetExecutingAssembly().GetName().Name + ".XML"
|
||||
Dim commentsFile = Path.Combine(baseDirectory, commentsFileName)
|
||||
|
||||
GlobalConfiguration.Configuration.EnableSwagger(Function(c)
|
||||
GlobalConfiguration.Configuration.EnableSwagger(Function(c) As SwaggerDocsConfig
|
||||
|
||||
|
||||
c.PrettyPrint()
|
||||
c.MultipleApiVersions(Function(apiDesc, targetApiVersion) ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), Function(vc)
|
||||
c.MultipleApiVersions(Function(apiDesc, targetApiVersion) ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), Function(vc) As VersionInfoBuilder
|
||||
|
||||
vc.Version("v1", descr & " V1").Description("A sample API for testing ").TermsOfService("Some Terms").Contact(Function(cont)
|
||||
cont.Name("VERAG AG")
|
||||
cont.Url("http://test.at")
|
||||
cont.Email("Mail.test")
|
||||
End Function).License(Function(lic)
|
||||
lic.Name("Lizenz")
|
||||
lic.Url("http://test.at")
|
||||
End Function)
|
||||
vc.Version("1", descr & " V1").Description("A sample API for testing ").TermsOfService("Some Terms").Contact(Function(cont) As ContactBuilder
|
||||
cont.Name("VERAG AG")
|
||||
cont.Url("http://test.at")
|
||||
cont.Email("Mail.test")
|
||||
End Function).License(Function(lic)
|
||||
lic.Name("Lizenz")
|
||||
lic.Url("http://test.at")
|
||||
End Function)
|
||||
|
||||
|
||||
vc.Version("v2", descr & " V2")
|
||||
vc.Version("v3", descr & " V3")
|
||||
vc.Version("2", descr & " V2")
|
||||
vc.Version("3", descr & " V3")
|
||||
Return vc
|
||||
End Function)
|
||||
|
||||
|
||||
@@ -59,8 +60,8 @@ Public Class SwaggerConfig
|
||||
'c.OperationFilter(Of BasicAuthenticationAttribute)()
|
||||
|
||||
|
||||
|
||||
End Function).EnableSwaggerUi(Function(c)
|
||||
Return c
|
||||
End Function).EnableSwaggerUi(Function(c) As SwaggerUiConfig
|
||||
c.DocumentTitle(descr)
|
||||
|
||||
c.EnableDiscoveryUrlSelector()
|
||||
@@ -68,13 +69,13 @@ Public Class SwaggerConfig
|
||||
|
||||
c.CustomAsset("index", thisAssembly, "VERAG_REST_SERVER.my_index.html")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Return c
|
||||
End Function)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -85,15 +86,27 @@ Public Class SwaggerConfig
|
||||
End Function
|
||||
|
||||
Public Shared Sub Register(ByVal config As HttpConfiguration)
|
||||
|
||||
RouteTable.Routes.MapOwinPath("swagger", Function(app) As Owin.IAppBuilder
|
||||
Return app.UseSwaggerUi3(GetType(WebApiApplication).Assembly, Function(settings) As SwaggerUi3Settings(Of NSwag.Generation.WebApi.WebApiOpenApiDocumentGeneratorSettings)
|
||||
settings.MiddlewareBasePath = "/swagger"
|
||||
settings.GeneratorSettings.DefaultUrlTemplate = "api/{controller}/{id}"
|
||||
|
||||
|
||||
|
||||
Return settings
|
||||
End Function)
|
||||
app.UseSwaggerUi(GetType(WebApiApplication).Assembly, Function(settings) As SwaggerUiSettings(Of NSwag.Generation.WebApi.WebApiOpenApiDocumentGeneratorSettings)
|
||||
settings.MiddlewareBasePath = "/swagger"
|
||||
settings.GeneratorSettings.DefaultUrlTemplate = "api/{controller}/{id}"
|
||||
settings.DocumentTitle = descr
|
||||
settings.DocExpansion = "list"
|
||||
settings.DefaultModelsExpandDepth = -1
|
||||
Return settings
|
||||
End Function)
|
||||
|
||||
|
||||
|
||||
Return app
|
||||
End Function)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user