This commit is contained in:
2023-02-22 10:25:52 +01:00
parent 152312175f
commit 902685c7cf
7 changed files with 17 additions and 12 deletions

View File

@@ -23,9 +23,11 @@ Public Class SwaggerConfig
c.PrettyPrint() c.PrettyPrint()
c.MultipleApiVersions(Function(apiDesc, targetApiVersion) ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), Function(vc) c.MultipleApiVersions(Function(apiDesc, targetApiVersion) ResolveVersionSupportByRouteConstraint(apiDesc, targetApiVersion), Function(vc)
vc.Version("1", descr & " V1") vc.Version("v1", descr & " V1")
vc.Version("2", descr & " V2") vc.Version("v2", descr & " V2")
vc.Version("v3", descr & " V3")
End Function) End Function)
c.ApiKey("apiKey").Description("API Key Authentication").Name("apiKey").In("header")
'c.OAuth2("oauth2").Description("OAuth2 Implicit Grant").Flow("implicit").AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog").Scopes(Function(scopes) 'c.OAuth2("oauth2").Description("OAuth2 Implicit Grant").Flow("implicit").AuthorizationUrl("http://petstore.swagger.wordnik.com/api/oauth/dialog").Scopes(Function(scopes)
' scopes.Add("read", "Read access to protected resources") ' scopes.Add("read", "Read access to protected resources")
@@ -36,16 +38,19 @@ Public Class SwaggerConfig
c.DocumentTitle(descr) c.DocumentTitle(descr)
c.EnableDiscoveryUrlSelector() c.EnableDiscoveryUrlSelector()
c.DocExpansion(DocExpansion.List) c.DocExpansion(DocExpansion.List)
c.EnableApiKeySupport("apiKey", "header")
'c.EnableOAuth2Support(clientId:="test-client-id", clientSecret:=Nothing, realm:="test-realm", appName:="Swagger UI", additionalQueryStringParams:=New Dictionary(Of String, String)() From { 'c.EnableOAuth2Support(clientId:="test-client-id", clientSecret:=Nothing, realm:="test-realm", appName:="Swagger UI", additionalQueryStringParams:=New Dictionary(Of String, String)() From {
' {"foo", "bar"} ' {"foo", "bar"}
'}) '})
End Function) End Function)
End Sub End Sub
Public Shared Function ResolveVersionSupportByRouteConstraint(ByVal apiDesc As ApiDescription, ByVal targetApiVersion As String) As Boolean Public Shared Function ResolveVersionSupportByRouteConstraint(ByVal apiDesc As ApiDescription, ByVal targetApiVersion As String) As Boolean
'Return apiDesc.ID.Contains($"/{targetApiVersion}/") Return apiDesc.ID.Contains($"/{targetApiVersion}/")
Return apiDesc.ActionDescriptor.ControllerDescriptor.ControllerType.FullName.Contains($"{targetApiVersion}") 'Return apiDesc.ActionDescriptor.ControllerDescriptor.ControllerType.FullName.Contains($"{targetApiVersion}")
End Function End Function

View File

@@ -7,7 +7,7 @@ Namespace ApiController.Controllers
<ApiVersion("1")> <ApiVersion("1")>
<System.Web.Http.Route("api/v{version:apiVersion}/AVISO")> <System.Web.Http.Route("api/v{version:apiVersion}/AVISO")>
Public Class AVISOV1Controller Public Class AVISOController
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValue() As String Public Function GetValue() As String
@@ -195,7 +195,7 @@ Namespace ApiController.Controllers
<ApiVersion("1")> <ApiVersion("1")>
<System.Web.Http.Route("api/v{version:apiVersion}/TEST/AVISO")> <System.Web.Http.Route("api/v{version:apiVersion}/TEST/AVISO")>
Public Class AVISOV1TESTController Public Class AVISO1TESTController
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValue() As String Public Function GetValue() As String

View File

@@ -8,7 +8,7 @@ Namespace api_CustomsDeclaration.Controllers
<ApiVersion("1")> <ApiVersion("1")>
<System.Web.Http.Route("api/v{version:apiVersion}/CustomsDeclaration")> <System.Web.Http.Route("api/v{version:apiVersion}/CustomsDeclaration")>
Public Class CustomsDeclarationV1Controller Public Class CustomsDeclaration1Controller
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza

View File

@@ -9,7 +9,7 @@ Namespace ApiController.Controllers
<ApiVersion("1")> <ApiVersion("1")>
<System.Web.Http.Route("api/v{version:apiVersion}/TR_NCTS")> <System.Web.Http.Route("api/v{version:apiVersion}/TR_NCTS")>
Public Class TR_NCTSV001Controller Public Class TR_NCTS1Controller
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
'Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_out_ncts 'Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_out_ncts
@@ -171,7 +171,7 @@ Namespace ApiController.Controllers
For Each PAC In ITEM.PACGS2 For Each PAC In ITEM.PACGS2
Dim PACK As New VERAG_PROG_ALLGEMEIN.cNCTS_TR_WarenpositionPackstuecke Dim PACK As New VERAG_PROG_ALLGEMEIN.cNCTS_TR_WarenpositionPackstuecke
PACK.nctsWpPk_PackstueckeAnzahl = PAC.NumOfPacGS24 PACK.nctsWpPk_PackstueckeAnzahl = PAC.NumOfPacGS24
PACK.nctsWpPk_Verpackungsart = PAC.KinOfPacGS23 PACK.nctsWpPk_Verpackungsart = PAC.KinOfPacGS23
POS.nctsWP_PACKSTUECKE.Add(PACK) POS.nctsWP_PACKSTUECKE.Add(PACK)
If PACK.nctsWpPk_PackstueckeAnzahl Is Nothing Then Return NCTS_Exceptions.ERR_05_Missing_Colli If PACK.nctsWpPk_PackstueckeAnzahl Is Nothing Then Return NCTS_Exceptions.ERR_05_Missing_Colli
Next Next

View File

@@ -10,7 +10,7 @@ Namespace NEWTESTController.Controllers
<ApiVersion("1")> <ApiVersion("1")>
<System.Web.Http.Route("api/v{version:apiVersion}/NEWTEST")> <System.Web.Http.Route("api/v{version:apiVersion}/NEWTEST")>
Public Class NEWTESTV1Controller Public Class NEWTEST1Controller
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValues() As String Public Function GetValues() As String

View File

@@ -6,7 +6,7 @@ Namespace api_CustomsDeclaration.Controllers
<ApiVersion("2")> <ApiVersion("2")>
<System.Web.Http.Route("api/v{version:apiVersion}/CustomsDeclaration")> <System.Web.Http.Route("api/v{version:apiVersion}/CustomsDeclaration")>
Public Class CustomsDeclarationV2Controller Public Class CustomsDeclaration2Controller
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza Public Function GetValues() As VERAG_PROG_ALLGEMEIN.cVERAG_in_eza

View File

@@ -9,7 +9,7 @@ Namespace NEWTESTController.Controllers
<ApiVersion("2")> <ApiVersion("2")>
<ApiVersion("3")> <ApiVersion("3")>
<System.Web.Http.Route("api/v{version:apiVersion}/NEWTEST")> <System.Web.Http.Route("api/v{version:apiVersion}/NEWTEST")>
Public Class NEWTESTV2Controller Public Class NEWTEST2Controller
Inherits System.Web.Http.ApiController Inherits System.Web.Http.ApiController
Public Function GetValues() As String Public Function GetValues() As String