diff --git a/Makefile b/Makefile index 33eff35e..f7eb47c6 100644 --- a/Makefile +++ b/Makefile @@ -8,10 +8,10 @@ endif all: tidy generate build check test generate: - oapi-codegen -generate client,spec -package=rest ./resources/client-v1.yaml > rest/services.gen.go - oapi-codegen -generate types -package=rest ./resources/client-v1.yaml > rest/types.gen.go - oapi-codegen -generate client -package=metricsclient ./resources/metrics-v1.yaml > metricsclient/services.gen.go - oapi-codegen -generate types -package=metricsclient ./resources/metrics-v1.yaml > metricsclient/types.gen.go + oapi-codegen --config ./resources/config/rest-client-config.yaml ./resources/client-v1.yaml > rest/services.gen.go + oapi-codegen --config ./resources/config/rest-types-config.yaml ./resources/client-v1.yaml > rest/types.gen.go + oapi-codegen --config ./resources/config/metrics-client-config.yaml ./resources/metrics-v1.yaml > metricsclient/services.gen.go + oapi-codegen --config ./resources/config/metrics-types-config.yaml ./resources/metrics-v1.yaml > metricsclient/types.gen.go tidy: go mod tidy @@ -95,7 +95,7 @@ $(GOPATH)/bin/gosec: $(GOPATH)/bin/oapi-codegen: @echo "🔘 Installing oapicodegen ... (`date '+%H:%M:%S'`)" - @go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.6.0 + @go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.11.0 PHONY+= tools tools: $(GOPATH)/bin/golangci-lint $(GOPATH)/bin/golint $(GOPATH)/bin/gosec $(GOPATH)/bin/goimports $(GOPATH)/bin/oapi-codegen diff --git a/analyticsservice/analytics.go b/analyticsservice/analytics.go index 2f3f899a..81076686 100644 --- a/analyticsservice/analytics.go +++ b/analyticsservice/analytics.go @@ -228,7 +228,7 @@ func (as *AnalyticsService) sendDataAndResetCache(ctx context.Context) { md := metricsclient.MetricsData{ Timestamp: time.Now().UnixNano() / (int64(time.Millisecond) / int64(time.Nanosecond)), Count: analytic.count, - MetricsType: ffMetricType, + MetricsType: metricsclient.MetricsDataMetricsType(ffMetricType), Attributes: metricAttributes, } metricData = append(metricData, md) diff --git a/evaluation/evaluator.go b/evaluation/evaluator.go index d1f53819..0ff677f8 100644 --- a/evaluation/evaluator.go +++ b/evaluation/evaluator.go @@ -203,7 +203,7 @@ func (e Evaluator) evaluateVariationMap(variationsMap []rest.VariationMap, targe func (e Evaluator) evaluateFlag(fc rest.FeatureConfig, target *Target) (rest.Variation, error) { var variation = fc.OffVariation - if fc.State == rest.FeatureState_on { + if fc.State == rest.FeatureStateOn { variation = "" if fc.VariationToTargetMap != nil { variation = e.evaluateVariationMap(*fc.VariationToTargetMap, target) @@ -321,8 +321,7 @@ func (e Evaluator) evaluate(identifier string, target *Target, kind string) (res if err != nil { return rest.Variation{}, err } - - if flag.Kind != kind { + if string(flag.Kind) != kind { return rest.Variation{}, fmt.Errorf("%w, expected: %s, got: %s", ErrFlagKindMismatch, kind, flag.Kind) } diff --git a/evaluation/evaluator_test.go b/evaluation/evaluator_test.go index ce20d945..fc70420d 100644 --- a/evaluation/evaluator_test.go +++ b/evaluation/evaluator_test.go @@ -104,7 +104,7 @@ var ( map[string]rest.FeatureConfig{ simple: { Feature: simple, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &identifierTrue, }, @@ -113,7 +113,7 @@ var ( }, theme: { Feature: theme, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &lighttheme, }, @@ -122,7 +122,7 @@ var ( }, size: { Feature: size, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &mediumSize, }, @@ -131,7 +131,7 @@ var ( }, weight: { Feature: weight, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &heavyWeight, }, @@ -140,7 +140,7 @@ var ( }, org: { Feature: org, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &json2, }, @@ -149,7 +149,7 @@ var ( }, invalidInt: { Feature: invalidInt, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &invalidIntValue, }, @@ -163,7 +163,7 @@ var ( }, invalidNumber: { Feature: invalidNumber, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &invalidNumberValue, }, @@ -177,7 +177,7 @@ var ( }, invalidJSON: { Feature: invalidJSON, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &invalidNumberValue, }, @@ -191,7 +191,7 @@ var ( }, simpleWithPrereq: { Feature: simpleWithPrereq, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &identifierTrue, }, @@ -206,7 +206,7 @@ var ( }, prereqNotFound: { Feature: prereqNotFound, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &identifierTrue, }, @@ -222,7 +222,7 @@ var ( prereqVarNotFound: { Feature: prereqVarNotFound, OffVariation: offVariation, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &identifierTrue, }, @@ -237,7 +237,7 @@ var ( }, notValidFlag: { Feature: notValidFlag, - State: rest.FeatureState_on, + State: rest.FeatureStateOn, DefaultServe: rest.Serve{ Variation: &empty, }, @@ -952,7 +952,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { args: args{ fc: rest.FeatureConfig{ OffVariation: offVariation, - State: rest.FeatureState_off, + State: rest.FeatureStateOff, Variations: boolVariations, }, }, @@ -964,7 +964,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { args: args{ fc: rest.FeatureConfig{ OffVariation: offVariation, - State: rest.FeatureState_off, + State: rest.FeatureStateOff, Variations: boolVariations, }, target: &Target{ @@ -978,7 +978,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { name: "evaluate flag should return default serve variation", args: args{ fc: rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Variations: boolVariations, DefaultServe: rest.Serve{ Variation: &boolVariations[0].Value, @@ -995,7 +995,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { name: "evaluate flag should return default serve distribution", args: args{ fc: rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Variations: boolVariations, DefaultServe: rest.Serve{ Distribution: &rest.Distribution{ @@ -1023,7 +1023,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { name: "evaluate flag should return rule serve", args: args{ fc: rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Variations: boolVariations, Rules: &[]rest.ServingRule{ { @@ -1051,7 +1051,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { name: "evaluate flag using variationMap and target should return 'true'", args: args{ fc: rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Variations: boolVariations, VariationToTargetMap: &[]rest.VariationMap{ { @@ -1075,7 +1075,7 @@ func TestEvaluator_evaluateFlag(t *testing.T) { name: "evaluate flag variation returns an error", args: args{ fc: rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, }, target: &Target{ Identifier: targetIdentifier, @@ -1240,7 +1240,7 @@ func TestEvaluator_checkPreRequisite(t *testing.T) { }, args: args{ parent: &rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Prerequisites: &[]rest.Prerequisite{ { Feature: simple, @@ -1258,7 +1258,7 @@ func TestEvaluator_checkPreRequisite(t *testing.T) { }, args: args{ parent: &rest.FeatureConfig{ - State: rest.FeatureState_on, + State: rest.FeatureStateOn, Prerequisites: &[]rest.Prerequisite{ { Feature: "prereq not found", diff --git a/go.mod b/go.mod index a0c385c4..5ae2ac99 100644 --- a/go.mod +++ b/go.mod @@ -3,22 +3,20 @@ module github.com/harness/ff-golang-server-sdk go 1.16 require ( - github.com/deepmap/oapi-codegen v1.6.0 - github.com/fatih/structtag v1.2.0 // indirect - github.com/getkin/kin-openapi v0.53.0 - github.com/golang-jwt/jwt v3.2.1+incompatible - github.com/google/uuid v1.2.0 + github.com/deepmap/oapi-codegen v1.11.0 + github.com/getkin/kin-openapi v0.94.0 + github.com/golang-jwt/jwt v3.2.2+incompatible + github.com/google/uuid v1.3.0 github.com/hashicorp/go-retryablehttp v0.6.8 github.com/hashicorp/golang-lru v0.5.4 github.com/jarcoal/httpmock v1.0.8 - github.com/json-iterator/go v1.1.10 + github.com/json-iterator/go v1.1.12 github.com/mitchellh/go-homedir v1.1.0 github.com/mitchellh/mapstructure v1.3.3 github.com/r3labs/sse v0.0.0-20201126193848-34e640891548 github.com/spaolacci/murmur3 v1.1.0 - github.com/stretchr/testify v1.5.1 + github.com/stretchr/testify v1.7.1 go.uber.org/multierr v1.6.0 // indirect go.uber.org/zap v1.16.0 - golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f // indirect - gopkg.in/cenkalti/backoff.v1 v1.1.0 // indirect + gopkg.in/cenkalti/backoff.v1 v1.1.0 ) diff --git a/go.sum b/go.sum index 0ecbddbc..1c072bc5 100644 --- a/go.sum +++ b/go.sum @@ -1,30 +1,46 @@ github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deepmap/oapi-codegen v1.6.0 h1:w/d1ntwh91XI0b/8ja7+u5SvA4IFfM0UNNLmiDR1gg0= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/fatih/structtag v1.2.0 h1:/OdNE99OxoI/PqaW/SuSK9uxxT3f/tcSZgon/ssNSx4= -github.com/fatih/structtag v1.2.0/go.mod h1:mBJUNpUnHmRKrKlQQlmCrh5PuhftFbNv8Ys4/aAZl94= -github.com/getkin/kin-openapi v0.53.0 h1:7WzP+MZRRe7YQz2Kc74Ley3dukJmXDvifVbElGmQfoA= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= +github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.0-20210816181553-5444fa50b93d/go.mod h1:tmAIfUFEirG/Y8jhZ9M+h36obRZAk/1fcSpXwAVlfqE= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= +github.com/deepmap/oapi-codegen v1.11.0 h1:f/X2NdIkaBKsSdpeuwLnY/vDI0AtPUrmB5LMgc7YD+A= +github.com/deepmap/oapi-codegen v1.11.0/go.mod h1:k+ujhoQGxmQYBZBbxhOZNZf4j08qv5mC+OH+fFTnKxM= +github.com/getkin/kin-openapi v0.94.0 h1:bAxg2vxgnHHHoeefVdmGbR+oxtJlcv5HsJJa3qmAHuo= +github.com/getkin/kin-openapi v0.94.0/go.mod h1:LWZfzOd7PRy8GJ1dJ6mCU6tNdSfOwRac1BUPam4aw6Q= github.com/ghodss/yaml v1.0.0 h1:wQHKEahhL6wmXdzwWG11gIVCkOv05bNOh+Rxn0yngAk= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= +github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= +github.com/gin-gonic/gin v1.7.7/go.mod h1:axIBovoeJpVj8S3BwE0uPMTeReE4+AfFtqpqaZ1qq1U= +github.com/go-chi/chi/v5 v5.0.7/go.mod h1:DslCQbL2OYiznFReuXYUmQ2hGd1aDpCnlMNITLSKoi8= github.com/go-openapi/jsonpointer v0.19.5 h1:gZr+CIYByUqjcgeLXnQu2gHYQC9o73G2XUeOFYEICuY= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5 h1:lTz6Ys4CmqqCQmZPBlbQENR1/GucA2bzYTE12Pw4tFY= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= -github.com/golang-jwt/jwt v3.2.1+incompatible h1:73Z+4BJcrTC+KczS6WvTPvRGOp1WmfEP4Q1lOd9Z/+c= -github.com/golang-jwt/jwt v3.2.1+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/go-openapi/swag v0.21.1 h1:wm0rhTb5z7qpJRHBdPOMuY4QjVUMbF6/kwoYeRAOrKU= +github.com/go-openapi/swag v0.21.1/go.mod h1:QYRuS/SOXUCsnplDa677K7+DxSOj6IPNl/eQntq43wQ= +github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= +github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= +github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= +github.com/go-playground/validator/v10 v10.4.1/go.mod h1:nlOn6nFhuKACm19sB/8EGNn9GlaMV7XkbRSipzJ0Ii4= +github.com/go-playground/validator/v10 v10.11.0/go.mod h1:i+3WkQ1FvaUjjxh1kSvIA4dMGDBiPU55YFDl0WbKdWU= +github.com/goccy/go-json v0.9.7/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I= +github.com/golang-jwt/jwt v3.2.2+incompatible h1:IfV12K8xAKAnZqdXVzCZ+TOjboZ2keLg81eXfW3O+oY= +github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= +github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= -github.com/google/uuid v1.2.0 h1:qJYtXnJRWmpe7m/3XlyhrsLrEURqHRM2kxzoxXqyUDs= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I= +github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= github.com/hashicorp/go-cleanhttp v0.5.1 h1:dH3aiDG9Jvb5r5+bYHsikaOUIpcM0xvgMXVoDkXMzJM= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= @@ -36,58 +52,89 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/jarcoal/httpmock v1.0.8 h1:8kI16SoO6LQKgPE7PvQuV+YuD/inwHd7fOOe2zMbo4k= github.com/jarcoal/httpmock v1.0.8/go.mod h1:ATjnClrvW/3tijVmpL/va5Z3aAyGvqU3gCT8nX0Txik= -github.com/json-iterator/go v1.1.10 h1:Kz6Cvnvv2wGdaG/V8yMvfkmNiXq9Ya2KUv4rouJJr68= -github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.0 h1:WgNl7dwNpEZ6jJ9k1snq4pZsg7DOEN8hP9Xw0Tsjwk0= +github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/labstack/echo/v4 v4.2.1 h1:LF5Iq7t/jrtUuSutNuiEWtB5eiHfZ5gSe2pcu5exjQw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0 h1:JEeO0bvc78PKdyHxloTKiF8BD5iGrH8T6MSeGvSgob0= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/labstack/echo/v4 v4.7.2 h1:Kv2/p8OaQ+M6Ex4eGimg9b9e6icoxA42JSlOR3msKtI= +github.com/labstack/echo/v4 v4.7.2/go.mod h1:xkCDAdFCIf8jsFQ5NnbK7oqaF/yU1A1X20Ltm0OvSks= +github.com/labstack/gommon v0.3.1 h1:OomWaJXm7xR6L1HmEtGyQf26TEn7V6X88mktX9kee9o= +github.com/labstack/gommon v0.3.1/go.mod h1:uW6kP17uPlLJsD3ijUYn3/M5bAxtlZhMI6m3MFxTMTM= +github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= +github.com/lestrrat-go/backoff/v2 v2.0.8/go.mod h1:rHP/q/r9aT27n24JQLa7JhSQZCKBBOiM/uP402WwN8Y= +github.com/lestrrat-go/blackmagic v1.0.0/go.mod h1:TNgH//0vYSs8VXDCfkZLgIrVTTXQELZffUV0tz3MtdQ= +github.com/lestrrat-go/blackmagic v1.0.1/go.mod h1:UrEqBzIR2U6CnzVyUtfM6oZNMt/7O7Vohk2J0OGSAtU= +github.com/lestrrat-go/httpcc v1.0.1/go.mod h1:qiltp3Mt56+55GPVCbTdM9MlqhvzyuL6W/NMDA8vA5E= +github.com/lestrrat-go/iter v1.0.1/go.mod h1:zIdgO1mRKhn8l9vrZJZz9TUMMFbQbLeTsbqPDrJ/OJc= +github.com/lestrrat-go/iter v1.0.2/go.mod h1:Momfcq3AnRlRjI5b5O8/G5/BvpzrhoFTZcn06fEOPt4= +github.com/lestrrat-go/jwx v1.2.24/go.mod h1:zoNuZymNl5lgdcu6P7K6ie2QRll5HVfF4xwxBBK1NxY= +github.com/lestrrat-go/option v1.0.0/go.mod h1:5ZHFbivi4xwXxhxY9XHDe2FHo6/Z7WWmtT7T5nBBp3I= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e h1:hB2xlXdHp/pmPZq0y3QnmWAArdw9PqbmotexnWx/FU8= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8 h1:c1ghPdyEDarC70ftn0y+A/Ee++9zz8ljHG1b13eJ0s8= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= +github.com/mailru/easyjson v0.7.6/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/matryer/moq v0.2.7/go.mod h1:kITsx543GOENm48TUAQyJ9+SAvFSr7iGQXPoth/VUBk= +github.com/mattn/go-colorable v0.1.11/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= +github.com/mattn/go-colorable v0.1.12 h1:jF+Du6AlPIjs2BiUiQlKOX0rt3SujHxPnksPKZbaA40= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= +github.com/mattn/go-isatty v0.0.14 h1:yVuAays6BHfxijgZPzw+3Zlu5yQgKGP2/hcQbHb7S9Y= +github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= +github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= +github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/r3labs/sse v0.0.0-20201126193848-34e640891548 h1:ewzX4RiFeFXl8APBmMqXBXR5CZoF/jctB71BuLg7d3s= github.com/r3labs/sse v0.0.0-20201126193848-34e640891548/go.mod h1:S8xSOnV3CgpNrWd0GQ/OoQfMtlg2uPRSuTzcSGrzwK8= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.8.0 h1:FCbCCtXNOY3UtUuHUYaghJg4y7Fd14rXifAYUAtL9R8= +github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI= github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= -github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.1 h1:5TQK59W5E3v0r2duFAb7P95B6hEeOyEnHRa8MjYSMTY= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVMw= +github.com/ugorji/go v1.2.7/go.mod h1:nF9osbDWLy6bDVv/Rtoh6QgnvNDpmCalQV5urGCCS6M= +github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= +github.com/yuin/goldmark v1.4.1/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0 h1:ADUqmZGgLDDfbSL9ZmPxKTybcoEYHgpYfELNoN+7hsw= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= @@ -100,56 +147,85 @@ go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad h1:DN0cp81fZ3njFcrLCytUHRSUkqBjfTo4Tx9RJTWs0EY= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= +golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20211215153901-e495a2d5b3d3/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9 h1:NUzdAbFtCJSXU20AOXgeqaUwg8Ypg4MPYmL+d+rsB5c= +golang.org/x/crypto v0.0.0-20220513210258-46612604a0f9/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA6JiaEZDtJb9Ei+1LlBs= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3 h1:kQgndtyPBW/JIYERgdxfwMYh3AVStj88WQTlNDi2a+o= +golang.org/x/mod v0.6.0-dev.0.20220106191415-9b9b3d81d5e3/go.mod h1:3p9vT2HGsQu2K1YbXdKPJLVgG5VJdoTa1poYQBtP1AY= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20191116160921-f9c825593386/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777 h1:003p0dJM77cxMSyCPFphvZf/Y5/NXf5fzg6ufd1/Oew= -golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220513224357-95641704303c h1:nF9mHSvoKBLkQNQhJZNsc66z2UzAMUbLGjC95CF3pU0= +golang.org/x/net v0.0.0-20220513224357-95641704303c/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c h1:VwygUrnw9jn88c4u8GD3rZQbqrP/tgas88tPUbBxQrk= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211103235746-7861aae1554b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a h1:N2T1jUrTQE9Re6TFF5PhvEHXHCguynGhKjWVsIUt5cY= +golang.org/x/sys v0.0.0-20220513210249-45d2b4557a2a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/text v0.3.5 h1:i6eZZ+zk0SOf0xgBpEpPD18qWcJda6q1sxt3S0kzyUQ= -golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/time v0.0.0-20220411224347-583f2d630306/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f h1:kDxGY2VmgABOe55qheT/TFqUMtcTHnomIPS1iv3G4Ms= -golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.10 h1:QjFRCZxdOhBJ/UNgnBZLbNV13DlbnK0quyivTnXJM20= +golang.org/x/tools v0.1.10/go.mod h1:Uh6Zz+xoGYZom868N8YTex3t7RhtHDBrE8Gzo9bV56E= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f h1:GGU+dLjvlC3qDwqYgL6UgRmHXhOOgns0bZu2Ty5mm6U= +golang.org/x/xerrors v0.0.0-20220411194840-2f41105eb62f/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw= +google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc= +google.golang.org/protobuf v1.28.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I= gopkg.in/cenkalti/backoff.v1 v1.1.0 h1:Arh75ttbsvlpVA7WtVpH4u9h6Zl46xuptxqLxPiSo4Y= gopkg.in/cenkalti/backoff.v1 v1.1.0/go.mod h1:J6Vskwqd+OMVJl8C33mmtxTBs2gyzfv7UDAkHu8BrjI= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU= +gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= +gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= diff --git a/metricsclient/services.gen.go b/metricsclient/services.gen.go index 85959861..9e9793a4 100644 --- a/metricsclient/services.gen.go +++ b/metricsclient/services.gen.go @@ -1,6 +1,6 @@ // Package metricsclient provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package metricsclient import ( @@ -90,7 +90,7 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // PostMetrics request with any body + // PostMetrics request with any body PostMetricsWithBody(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) PostMetrics(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -149,13 +149,13 @@ func NewPostMetricsRequestWithBody(server string, environment EnvironmentPathPar operationPath := fmt.Sprintf("/metrics/%s", pathParam0) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { @@ -210,7 +210,7 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // PostMetrics request with any body + // PostMetrics request with any body PostMetricsWithBodyWithResponse(ctx context.Context, environment EnvironmentPathParam, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) PostMetricsWithResponse(ctx context.Context, environment EnvironmentPathParam, body PostMetricsJSONRequestBody, reqEditors ...RequestEditorFn) (*PostMetricsResponse, error) @@ -260,7 +260,7 @@ func (c *ClientWithResponses) PostMetricsWithResponse(ctx context.Context, envir // ParsePostMetricsResponse parses an HTTP response from a PostMetricsWithResponse call func ParsePostMetricsResponse(rsp *http.Response) (*PostMetricsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } diff --git a/metricsclient/types.gen.go b/metricsclient/types.gen.go index 207515ad..69315ac0 100644 --- a/metricsclient/types.gen.go +++ b/metricsclient/types.gen.go @@ -1,12 +1,17 @@ // Package metricsclient provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package metricsclient const ( BearerAuthScopes = "BearerAuth.Scopes" ) +// Defines values for MetricsDataMetricsType. +const ( + MetricsDataMetricsTypeFFMETRICS MetricsDataMetricsType = "FFMETRICS" +) + // Error defines model for Error. type Error struct { Code string `json:"code"` @@ -31,12 +36,15 @@ type MetricsData struct { Count int `json:"count"` // This can be of type FeatureMetrics - MetricsType string `json:"metricsType"` + MetricsType MetricsDataMetricsType `json:"metricsType"` // time at when this data was recorded Timestamp int64 `json:"timestamp"` } +// This can be of type FeatureMetrics +type MetricsDataMetricsType string + // TargetData defines model for TargetData. type TargetData struct { Attributes []KeyValue `json:"attributes"` diff --git a/resources/config/metrics-client-config.yaml b/resources/config/metrics-client-config.yaml new file mode 100644 index 00000000..3268fe79 --- /dev/null +++ b/resources/config/metrics-client-config.yaml @@ -0,0 +1,7 @@ +package: metricsclient +generate: + client: true +compatibility: + old-enum-conflicts: true + old-aliasing: true + old-merge-schemas: true \ No newline at end of file diff --git a/resources/config/metrics-types-config.yaml b/resources/config/metrics-types-config.yaml new file mode 100644 index 00000000..939c4139 --- /dev/null +++ b/resources/config/metrics-types-config.yaml @@ -0,0 +1,7 @@ +package: metricsclient +generate: + models: true +compatibility: + old-enum-conflicts: true + old-aliasing: true + old-merge-schemas: true \ No newline at end of file diff --git a/resources/config/rest-client-config.yaml b/resources/config/rest-client-config.yaml new file mode 100644 index 00000000..c898ef2a --- /dev/null +++ b/resources/config/rest-client-config.yaml @@ -0,0 +1,10 @@ +package: rest +generate: + echo-server: false + client: true + models: false + embedded-spec: true +compatibility: + old-enum-conflicts: true + old-aliasing: true + old-merge-schemas: true \ No newline at end of file diff --git a/resources/config/rest-types-config.yaml b/resources/config/rest-types-config.yaml new file mode 100644 index 00000000..67384eee --- /dev/null +++ b/resources/config/rest-types-config.yaml @@ -0,0 +1,10 @@ +package: rest +generate: + echo-server: false + client: false + models: true + embedded-spec: false +compatibility: + old-enum-conflicts: true + old-aliasing: true + old-merge-schemas: true \ No newline at end of file diff --git a/rest/services.gen.go b/rest/services.gen.go index 9fcf93b8..c17fad5c 100644 --- a/rest/services.gen.go +++ b/rest/services.gen.go @@ -1,6 +1,6 @@ // Package rest provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package rest import ( @@ -14,6 +14,7 @@ import ( "io/ioutil" "net/http" "net/url" + "path" "strings" "github.com/deepmap/oapi-codegen/pkg/runtime" @@ -93,7 +94,7 @@ func WithRequestEditorFn(fn RequestEditorFn) ClientOption { // The interface specification for the client above. type ClientInterface interface { - // Authenticate request with any body + // Authenticate request with any body AuthenticateWithBody(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) Authenticate(ctx context.Context, body AuthenticateJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -250,13 +251,13 @@ func NewAuthenticateRequestWithBody(server string, contentType string, body io.R operationPath := fmt.Sprintf("/client/auth") if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("POST", queryURL.String(), body) if err != nil { @@ -286,13 +287,13 @@ func NewGetFeatureConfigRequest(server string, environmentUUID string) (*http.Re operationPath := fmt.Sprintf("/client/env/%s/feature-configs", pathParam0) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -327,13 +328,13 @@ func NewGetFeatureConfigByIdentifierRequest(server string, environmentUUID strin operationPath := fmt.Sprintf("/client/env/%s/feature-configs/%s", pathParam0, pathParam1) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -361,13 +362,13 @@ func NewGetAllSegmentsRequest(server string, environmentUUID string) (*http.Requ operationPath := fmt.Sprintf("/client/env/%s/target-segments", pathParam0) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -402,13 +403,13 @@ func NewGetSegmentByIdentifierRequest(server string, environmentUUID string, ide operationPath := fmt.Sprintf("/client/env/%s/target-segments/%s", pathParam0, pathParam1) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -443,13 +444,13 @@ func NewGetEvaluationsRequest(server string, environmentUUID string, target stri operationPath := fmt.Sprintf("/client/env/%s/target/%s/evaluations", pathParam0, pathParam1) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -491,13 +492,13 @@ func NewGetEvaluationByIdentifierRequest(server string, environmentUUID string, operationPath := fmt.Sprintf("/client/env/%s/target/%s/evaluations/%s", pathParam0, pathParam1, pathParam2) if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -518,13 +519,13 @@ func NewStreamRequest(server string, params *StreamParams) (*http.Request, error operationPath := fmt.Sprintf("/stream") if operationPath[0] == '/' { - operationPath = operationPath[1:] - } - operationURL := url.URL{ - Path: operationPath, + operationPath = "." + operationPath } - queryURL := serverURL.ResolveReference(&operationURL) + queryURL, err := serverURL.Parse(operationPath) + if err != nil { + return nil, err + } req, err := http.NewRequest("GET", queryURL.String(), nil) if err != nil { @@ -586,7 +587,7 @@ func WithBaseURL(baseURL string) ClientOption { // ClientWithResponsesInterface is the interface specification for the client with responses above. type ClientWithResponsesInterface interface { - // Authenticate request with any body + // Authenticate request with any body AuthenticateWithBodyWithResponse(ctx context.Context, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error) AuthenticateWithResponse(ctx context.Context, body AuthenticateJSONRequestBody, reqEditors ...RequestEditorFn) (*AuthenticateResponse, error) @@ -888,7 +889,7 @@ func (c *ClientWithResponses) StreamWithResponse(ctx context.Context, params *St // ParseAuthenticateResponse parses an HTTP response from a AuthenticateWithResponse call func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -942,7 +943,7 @@ func ParseAuthenticateResponse(rsp *http.Response) (*AuthenticateResponse, error // ParseGetFeatureConfigResponse parses an HTTP response from a GetFeatureConfigWithResponse call func ParseGetFeatureConfigResponse(rsp *http.Response) (*GetFeatureConfigResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -968,7 +969,7 @@ func ParseGetFeatureConfigResponse(rsp *http.Response) (*GetFeatureConfigRespons // ParseGetFeatureConfigByIdentifierResponse parses an HTTP response from a GetFeatureConfigByIdentifierWithResponse call func ParseGetFeatureConfigByIdentifierResponse(rsp *http.Response) (*GetFeatureConfigByIdentifierResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -994,7 +995,7 @@ func ParseGetFeatureConfigByIdentifierResponse(rsp *http.Response) (*GetFeatureC // ParseGetAllSegmentsResponse parses an HTTP response from a GetAllSegmentsWithResponse call func ParseGetAllSegmentsResponse(rsp *http.Response) (*GetAllSegmentsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -1048,7 +1049,7 @@ func ParseGetAllSegmentsResponse(rsp *http.Response) (*GetAllSegmentsResponse, e // ParseGetSegmentByIdentifierResponse parses an HTTP response from a GetSegmentByIdentifierWithResponse call func ParseGetSegmentByIdentifierResponse(rsp *http.Response) (*GetSegmentByIdentifierResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -1102,7 +1103,7 @@ func ParseGetSegmentByIdentifierResponse(rsp *http.Response) (*GetSegmentByIdent // ParseGetEvaluationsResponse parses an HTTP response from a GetEvaluationsWithResponse call func ParseGetEvaluationsResponse(rsp *http.Response) (*GetEvaluationsResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -1133,7 +1134,7 @@ func ParseGetEvaluationsResponse(rsp *http.Response) (*GetEvaluationsResponse, e // ParseGetEvaluationByIdentifierResponse parses an HTTP response from a GetEvaluationByIdentifierWithResponse call func ParseGetEvaluationByIdentifierResponse(rsp *http.Response) (*GetEvaluationByIdentifierResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -1159,7 +1160,7 @@ func ParseGetEvaluationByIdentifierResponse(rsp *http.Response) (*GetEvaluationB // ParseStreamResponse parses an HTTP response from a StreamWithResponse call func ParseStreamResponse(rsp *http.Response) (*StreamResponse, error) { bodyBytes, err := ioutil.ReadAll(rsp.Body) - defer rsp.Body.Close() + defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } @@ -1169,9 +1170,6 @@ func ParseStreamResponse(rsp *http.Response) (*StreamResponse, error) { HTTPResponse: rsp, } - switch { - } - return response, nil } @@ -1215,9 +1213,9 @@ var swaggerSpec = []string{ "3xBXE+GQ5DQ8M9Pb7qbr5NrOe5tfNyfJizBMeURSLXpxPpvNamF3u/8HAAD//9nheSPILQAA", } -// GetSwagger returns the Swagger specification corresponding to the generated code -// in this file. -func GetSwagger() (*openapi3.Swagger, error) { +// GetSwagger returns the content of the embedded swagger specification file +// or error if failed to decode +func decodeSpec() ([]byte, error) { zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) if err != nil { return nil, fmt.Errorf("error base64 decoding spec: %s", err) @@ -1232,9 +1230,57 @@ func GetSwagger() (*openapi3.Swagger, error) { return nil, fmt.Errorf("error decompressing spec: %s", err) } - swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData(buf.Bytes()) + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cached of a decoded swagger spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + var res = make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSwagger returns the Swagger specification corresponding to the generated code +// in this file. The external references of Swagger specification are resolved. +// The logic of resolving external references is tightly connected to "import-mapping" feature. +// Externally referenced files must be embedded in the corresponding golang packages. +// Urls can be supported but this task was out of the scope. +func GetSwagger() (swagger *openapi3.T, err error) { + var resolvePath = PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + var pathToFile = url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) if err != nil { - return nil, fmt.Errorf("error loading Swagger: %s", err) + return } - return swagger, nil + return } diff --git a/rest/types.gen.go b/rest/types.gen.go index 4677d727..a6a1b785 100644 --- a/rest/types.gen.go +++ b/rest/types.gen.go @@ -1,12 +1,26 @@ // Package rest provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package rest const ( BearerAuthScopes = "BearerAuth.Scopes" ) +// Defines values for FeatureConfigKind. +const ( + FeatureConfigKindBoolean FeatureConfigKind = "boolean" + FeatureConfigKindInt FeatureConfigKind = "int" + FeatureConfigKindJson FeatureConfigKind = "json" + FeatureConfigKindString FeatureConfigKind = "string" +) + +// Defines values for FeatureState. +const ( + FeatureStateOff FeatureState = "off" + FeatureStateOn FeatureState = "on" +) + // AuthenticationRequest defines model for AuthenticationRequest. type AuthenticationRequest struct { ApiKey string `json:"apiKey"` @@ -57,29 +71,26 @@ type Evaluations []Evaluation // FeatureConfig defines model for FeatureConfig. type FeatureConfig struct { - DefaultServe Serve `json:"defaultServe"` - Environment string `json:"environment"` - Feature string `json:"feature"` - Kind string `json:"kind"` - OffVariation string `json:"offVariation"` - Prerequisites *[]Prerequisite `json:"prerequisites,omitempty"` - Project string `json:"project"` - Rules *[]ServingRule `json:"rules,omitempty"` - State FeatureState `json:"state"` - VariationToTargetMap *[]VariationMap `json:"variationToTargetMap,omitempty"` - Variations []Variation `json:"variations"` - Version *int64 `json:"version,omitempty"` -} + DefaultServe Serve `json:"defaultServe"` + Environment string `json:"environment"` + Feature string `json:"feature"` + Kind FeatureConfigKind `json:"kind"` + OffVariation string `json:"offVariation"` + Prerequisites *[]Prerequisite `json:"prerequisites,omitempty"` + Project string `json:"project"` + Rules *[]ServingRule `json:"rules,omitempty"` + State FeatureState `json:"state"` + VariationToTargetMap *[]VariationMap `json:"variationToTargetMap,omitempty"` + Variations []Variation `json:"variations"` + Version *int64 `json:"version,omitempty"` +} + +// FeatureConfigKind defines model for FeatureConfig.Kind. +type FeatureConfigKind string // FeatureState defines model for FeatureState. type FeatureState string -// List of FeatureState -const ( - FeatureState_off FeatureState = "off" - FeatureState_on FeatureState = "on" -) - // Pagination defines model for Pagination. type Pagination struct { ItemCount int `json:"itemCount"` diff --git a/test_wrapper/Makefile b/test_wrapper/Makefile index 86968787..66cac1c9 100644 --- a/test_wrapper/Makefile +++ b/test_wrapper/Makefile @@ -1,9 +1,9 @@ install: - go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.6.0 + go get github.com/deepmap/oapi-codegen/cmd/oapi-codegen@v1.11.0 generate: # generate admin - oapi-codegen -generate server,spec -package=restapi ./test_wrapper_openapi/sdk_wrapper-v1.yaml > ./restapi/test_wrapper_service.gen.go - oapi-codegen -generate types -package=restapi ./test_wrapper_openapi/sdk_wrapper-v1.yaml > ./restapi/test_wrapper_types.gen.go + oapi-codegen --old-config-style -generate server,spec -package=restapi ./test_wrapper_openapi/sdk_wrapper-v1.yaml > ./restapi/test_wrapper_service.gen.go + oapi-codegen --old-config-style -generate types -package=restapi ./test_wrapper_openapi/sdk_wrapper-v1.yaml > ./restapi/test_wrapper_types.gen.go diff --git a/test_wrapper/go.mod b/test_wrapper/go.mod index 73d8012e..ebc75b02 100644 --- a/test_wrapper/go.mod +++ b/test_wrapper/go.mod @@ -5,7 +5,6 @@ go 1.16 replace github.com/harness/ff-golang-server-sdk => ../ require ( - github.com/deepmap/oapi-codegen v1.6.0 // indirect github.com/getkin/kin-openapi v0.89.0 github.com/harness/ff-golang-server-sdk v0.0.24 github.com/labstack/echo/v4 v4.6.3 diff --git a/test_wrapper/restapi/test_wrapper_service.gen.go b/test_wrapper/restapi/test_wrapper_service.gen.go index ed97e22f..5a61416e 100644 --- a/test_wrapper/restapi/test_wrapper_service.gen.go +++ b/test_wrapper/restapi/test_wrapper_service.gen.go @@ -1,6 +1,6 @@ // Package restapi provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package restapi import ( @@ -8,6 +8,8 @@ import ( "compress/gzip" "encoding/base64" "fmt" + "net/url" + "path" "strings" "github.com/getkin/kin-openapi/openapi3" @@ -97,9 +99,9 @@ var swaggerSpec = []string{ "3mIeviDFfhWk0qp0wiPcTZpOW6PfXh9ZmlYml1Uom52Mx5OXQnfbXwEAAP//7YR9Tu4IAAA=", } -// GetSwagger returns the Swagger specification corresponding to the generated code -// in this file. -func GetSwagger() (*openapi3.Swagger, error) { +// GetSwagger returns the content of the embedded swagger specification file +// or error if failed to decode +func decodeSpec() ([]byte, error) { zipped, err := base64.StdEncoding.DecodeString(strings.Join(swaggerSpec, "")) if err != nil { return nil, fmt.Errorf("error base64 decoding spec: %s", err) @@ -114,9 +116,57 @@ func GetSwagger() (*openapi3.Swagger, error) { return nil, fmt.Errorf("error decompressing spec: %s", err) } - swagger, err := openapi3.NewSwaggerLoader().LoadSwaggerFromData(buf.Bytes()) + return buf.Bytes(), nil +} + +var rawSpec = decodeSpecCached() + +// a naive cached of a decoded swagger spec +func decodeSpecCached() func() ([]byte, error) { + data, err := decodeSpec() + return func() ([]byte, error) { + return data, err + } +} + +// Constructs a synthetic filesystem for resolving external references when loading openapi specifications. +func PathToRawSpec(pathToFile string) map[string]func() ([]byte, error) { + var res = make(map[string]func() ([]byte, error)) + if len(pathToFile) > 0 { + res[pathToFile] = rawSpec + } + + return res +} + +// GetSwagger returns the Swagger specification corresponding to the generated code +// in this file. The external references of Swagger specification are resolved. +// The logic of resolving external references is tightly connected to "import-mapping" feature. +// Externally referenced files must be embedded in the corresponding golang packages. +// Urls can be supported but this task was out of the scope. +func GetSwagger() (swagger *openapi3.T, err error) { + var resolvePath = PathToRawSpec("") + + loader := openapi3.NewLoader() + loader.IsExternalRefsAllowed = true + loader.ReadFromURIFunc = func(loader *openapi3.Loader, url *url.URL) ([]byte, error) { + var pathToFile = url.String() + pathToFile = path.Clean(pathToFile) + getSpec, ok := resolvePath[pathToFile] + if !ok { + err1 := fmt.Errorf("path not found: %s", pathToFile) + return nil, err1 + } + return getSpec() + } + var specData []byte + specData, err = rawSpec() + if err != nil { + return + } + swagger, err = loader.LoadFromData(specData) if err != nil { - return nil, fmt.Errorf("error loading Swagger: %s", err) + return } - return swagger, nil + return } diff --git a/test_wrapper/restapi/test_wrapper_types.gen.go b/test_wrapper/restapi/test_wrapper_types.gen.go index f2be6889..662cd280 100644 --- a/test_wrapper/restapi/test_wrapper_types.gen.go +++ b/test_wrapper/restapi/test_wrapper_types.gen.go @@ -1,6 +1,6 @@ // Package restapi provides primitives to interact with the openapi HTTP API. // -// Code generated by github.com/deepmap/oapi-codegen DO NOT EDIT. +// Code generated by github.com/deepmap/oapi-codegen version v1.11.0 DO NOT EDIT. package restapi // Error Status for wrapper @@ -35,7 +35,7 @@ type PongResponse struct { } // GetFlagValueJSONBody defines parameters for GetFlagValue. -type GetFlagValueJSONBody FlagCheckBody +type GetFlagValueJSONBody = FlagCheckBody // GetFlagValueJSONRequestBody defines body for GetFlagValue for application/json ContentType. -type GetFlagValueJSONRequestBody GetFlagValueJSONBody +type GetFlagValueJSONRequestBody = GetFlagValueJSONBody diff --git a/tests/evaluator_test.go b/tests/evaluator_test.go index 68161750..29b412bd 100644 --- a/tests/evaluator_test.go +++ b/tests/evaluator_test.go @@ -110,15 +110,15 @@ func TestEvaluator(t *testing.T) { t.Errorf("flag %s not found", testCase.Flag) } switch flag.Kind { - case "boolean": + case rest.FeatureConfigKindBoolean: got = evaluator.BoolVariation(testCase.Flag, target, false) - case "string": + case rest.FeatureConfigKindString: got = evaluator.StringVariation(testCase.Flag, target, "blue") - case "int": + case rest.FeatureConfigKindInt: got = evaluator.IntVariation(testCase.Flag, target, 100) case "number": got = evaluator.NumberVariation(testCase.Flag, target, 50.00) - case "json": + case rest.FeatureConfigKindJson: got = evaluator.JSONVariation(testCase.Flag, target, map[string]interface{}{}) } if !reflect.DeepEqual(got, testCase.Expected) {