diff --git a/internal/proxy/generate.go b/internal/proxy/generate.go index f0b984a..48b4ea4 100644 --- a/internal/proxy/generate.go +++ b/internal/proxy/generate.go @@ -25,7 +25,7 @@ const prefixUpstream = "upstream-" func addTemplateFunc(pe ProxyExtension) { codegen.TemplateFunctions["upstreamOperationID"] = func(opid string) string { for k, v := range pe.Proxied() { - if opid != k.OperationId { + if opid != codegen.ToCamelCase(k.OperationId) { continue } diff --git a/internal/proxy/templates/proxy/strict/strict-interface.tmpl b/internal/proxy/templates/proxy/strict/strict-interface.tmpl index 41d0d90..0241679 100644 --- a/internal/proxy/templates/proxy/strict/strict-interface.tmpl +++ b/internal/proxy/templates/proxy/strict/strict-interface.tmpl @@ -24,7 +24,7 @@ type StrictServerInterface interface { {{range .}}{{.SummaryAsComment }} // ({{.Method}} {{.Path}}) {{$opid := .OperationId -}} -{{$opid}}(ctx context.Context, request {{$opid | ucFirst}}RequestObject) ({{ (or (upstreamOperationID $opid | camelCase) $opid) | ucFirst}}RequestObject, error) +{{$opid}}(ctx context.Context, request {{$opid | ucFirst}}RequestObject) ({{ (upstreamOperationID $opid | camelCase) | ucFirst}}RequestObject, error) {{end}}{{/* range . */ -}} } diff --git a/internal/proxy/testoutput/oapi-proxy-impl.go b/internal/proxy/testoutput/oapi-proxy-impl.go index 4837e7f..5c011c1 100644 --- a/internal/proxy/testoutput/oapi-proxy-impl.go +++ b/internal/proxy/testoutput/oapi-proxy-impl.go @@ -25,7 +25,7 @@ func (p proxyImpl) Profile() http.HandlerFunc { type serverImpl struct{} // ProfileGetProfile implements StrictServerInterface. -func (s serverImpl) ProfileGetProfile(ctx context.Context, request ProfileGetProfileRequestObject) (ProfileGetProfileRequestObject, error) { +func (s serverImpl) ProfileGetProfile(ctx context.Context, request ProfileGetProfileRequestObject) (UpstreamProfileGetProfileRequestObject, error) { panic("unimplemented") } diff --git a/internal/proxy/testoutput/oapi-proxy.go b/internal/proxy/testoutput/oapi-proxy.go index f642dec..9ec7835 100644 --- a/internal/proxy/testoutput/oapi-proxy.go +++ b/internal/proxy/testoutput/oapi-proxy.go @@ -294,7 +294,7 @@ type StrictServerInterface interface { PutProfile(ctx context.Context, request PutProfileRequestObject) (UpstreamProfilePutProfileRequestObject, error) // get profile // (GET /tenants/{tenant-id}/profiles/{profile-id}) - ProfileGetProfile(ctx context.Context, request ProfileGetProfileRequestObject) (ProfileGetProfileRequestObject, error) + ProfileGetProfile(ctx context.Context, request ProfileGetProfileRequestObject) (UpstreamProfileGetProfileRequestObject, error) // get profile // (GET /validated-profiles/{profile-id}) GetValidatedProfile(ctx context.Context, request GetValidatedProfileRequestObject) (UpstreamProfileGetProfileRequestObject, error)