From 559137fd7726e9ae4fd102c12ff370014f5bcfad Mon Sep 17 00:00:00 2001 From: zhuojie Date: Thu, 19 Mar 2020 14:35:05 -0700 Subject: [PATCH 1/2] Upgrade swagger go version and bump to 1.1.7 --- Makefile | 2 +- browser/flagr-ui/package.json | 2 +- docs/api_docs/bundle.yaml | 2 +- swagger/index.yaml | 2 +- swagger_gen/cmd/flagr-server/main.go | 3 +- swagger_gen/models/constraint.go | 4 +- .../models/create_constraint_request.go | 4 +- swagger_gen/models/create_flag_request.go | 4 +- swagger_gen/models/create_segment_request.go | 4 +- swagger_gen/models/create_variant_request.go | 4 +- swagger_gen/models/distribution.go | 4 +- swagger_gen/models/error.go | 4 +- swagger_gen/models/eval_context.go | 4 +- swagger_gen/models/eval_debug_log.go | 4 +- swagger_gen/models/eval_result.go | 4 +- .../models/evaluation_batch_request.go | 4 +- .../models/evaluation_batch_response.go | 4 +- swagger_gen/models/evaluation_entity.go | 4 +- swagger_gen/models/flag.go | 4 +- swagger_gen/models/flag_snapshot.go | 4 +- swagger_gen/models/health.go | 4 +- .../models/put_distributions_request.go | 4 +- swagger_gen/models/put_flag_request.go | 4 +- .../models/put_segment_reorder_request.go | 4 +- swagger_gen/models/put_segment_request.go | 4 +- swagger_gen/models/put_variant_request.go | 4 +- swagger_gen/models/segment.go | 4 +- swagger_gen/models/segment_debug_log.go | 4 +- .../models/set_flag_enabled_request.go | 4 +- swagger_gen/models/variant.go | 4 +- swagger_gen/restapi/doc.go | 39 ++-- swagger_gen/restapi/embedded_spec.go | 4 +- .../constraint/create_constraint.go | 2 +- .../create_constraint_parameters.go | 5 +- .../constraint/create_constraint_responses.go | 2 +- .../constraint/delete_constraint.go | 2 +- .../delete_constraint_parameters.go | 3 +- .../constraint/delete_constraint_responses.go | 2 +- .../operations/constraint/find_constraints.go | 2 +- .../constraint/find_constraints_parameters.go | 3 +- .../constraint/find_constraints_responses.go | 2 +- .../operations/constraint/put_constraint.go | 2 +- .../constraint/put_constraint_parameters.go | 5 +- .../constraint/put_constraint_responses.go | 2 +- .../distribution/find_distributions.go | 2 +- .../find_distributions_parameters.go | 3 +- .../find_distributions_responses.go | 2 +- .../distribution/put_distributions.go | 2 +- .../put_distributions_parameters.go | 5 +- .../put_distributions_responses.go | 2 +- .../operations/evaluation/post_evaluation.go | 2 +- .../evaluation/post_evaluation_batch.go | 2 +- .../post_evaluation_batch_parameters.go | 2 +- .../post_evaluation_batch_responses.go | 2 +- .../evaluation/post_evaluation_parameters.go | 2 +- .../evaluation/post_evaluation_responses.go | 2 +- .../export/get_export_eval_cache_json.go | 2 +- .../get_export_eval_cache_json_responses.go | 2 +- .../operations/export/get_export_sqlite.go | 2 +- .../export/get_export_sqlite_responses.go | 2 +- .../restapi/operations/flag/create_flag.go | 2 +- .../operations/flag/create_flag_parameters.go | 2 +- .../operations/flag/create_flag_responses.go | 2 +- .../restapi/operations/flag/delete_flag.go | 2 +- .../operations/flag/delete_flag_parameters.go | 3 +- .../operations/flag/delete_flag_responses.go | 2 +- .../restapi/operations/flag/find_flags.go | 2 +- .../operations/flag/find_flags_parameters.go | 3 +- .../operations/flag/find_flags_responses.go | 2 +- .../restapi/operations/flag/get_flag.go | 2 +- .../operations/flag/get_flag_entity_types.go | 2 +- .../flag/get_flag_entity_types_responses.go | 2 +- .../operations/flag/get_flag_parameters.go | 3 +- .../operations/flag/get_flag_responses.go | 2 +- .../operations/flag/get_flag_snapshots.go | 2 +- .../flag/get_flag_snapshots_parameters.go | 3 +- .../flag/get_flag_snapshots_responses.go | 2 +- .../restapi/operations/flag/put_flag.go | 2 +- .../operations/flag/put_flag_parameters.go | 5 +- .../operations/flag/put_flag_responses.go | 2 +- .../operations/flag/set_flag_enabled.go | 2 +- .../flag/set_flag_enabled_parameters.go | 5 +- .../flag/set_flag_enabled_responses.go | 2 +- swagger_gen/restapi/operations/flagr_api.go | 198 +++++++----------- .../restapi/operations/health/get_health.go | 2 +- .../operations/health/get_health_responses.go | 2 +- .../operations/segment/create_segment.go | 2 +- .../segment/create_segment_parameters.go | 5 +- .../segment/create_segment_responses.go | 2 +- .../operations/segment/delete_segment.go | 2 +- .../segment/delete_segment_parameters.go | 3 +- .../segment/delete_segment_responses.go | 2 +- .../operations/segment/find_segments.go | 2 +- .../segment/find_segments_parameters.go | 3 +- .../segment/find_segments_responses.go | 2 +- .../restapi/operations/segment/put_segment.go | 2 +- .../segment/put_segment_parameters.go | 5 +- .../segment/put_segment_responses.go | 2 +- .../segment/put_segments_reorder.go | 2 +- .../put_segments_reorder_parameters.go | 5 +- .../segment/put_segments_reorder_responses.go | 2 +- .../operations/variant/create_variant.go | 2 +- .../variant/create_variant_parameters.go | 5 +- .../variant/create_variant_responses.go | 2 +- .../operations/variant/delete_variant.go | 2 +- .../variant/delete_variant_parameters.go | 3 +- .../variant/delete_variant_responses.go | 2 +- .../operations/variant/find_variants.go | 2 +- .../variant/find_variants_parameters.go | 3 +- .../variant/find_variants_responses.go | 2 +- .../restapi/operations/variant/put_variant.go | 2 +- .../variant/put_variant_parameters.go | 5 +- .../variant/put_variant_responses.go | 2 +- swagger_gen/restapi/server.go | 10 +- 114 files changed, 248 insertions(+), 315 deletions(-) diff --git a/Makefile b/Makefile index ec972cdd..dbe36e4e 100644 --- a/Makefile +++ b/Makefile @@ -35,7 +35,7 @@ gen: api_docs swagger deps: checks @GO111MODULE=off go get -u github.com/myitcv/gobin - @gobin github.com/go-swagger/go-swagger/cmd/swagger@v0.21.0 + @gobin github.com/go-swagger/go-swagger/cmd/swagger@v0.23.0 @gobin github.com/codeskyblue/fswatch @gobin github.com/golangci/golangci-lint/cmd/golangci-lint@v1.24.0 @echo "Sqlite3" && sqlite3 -version diff --git a/browser/flagr-ui/package.json b/browser/flagr-ui/package.json index 66166bef..80122f60 100644 --- a/browser/flagr-ui/package.json +++ b/browser/flagr-ui/package.json @@ -1,6 +1,6 @@ { "name": "flagr-ui", - "version": "1.1.6", + "version": "1.1.7", "private": true, "scripts": { "serve": "vue-cli-service serve", diff --git a/docs/api_docs/bundle.yaml b/docs/api_docs/bundle.yaml index e28e57eb..d58ae2bd 100644 --- a/docs/api_docs/bundle.yaml +++ b/docs/api_docs/bundle.yaml @@ -4,7 +4,7 @@ info: Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1". title: Flagr - version: 1.1.6 + version: 1.1.7 tags: - name: flag description: Everything about the flag diff --git a/swagger/index.yaml b/swagger/index.yaml index 28d0cba5..cffa2b6d 100644 --- a/swagger/index.yaml +++ b/swagger/index.yaml @@ -5,7 +5,7 @@ info: Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1". title: Flagr - version: 1.1.6 + version: 1.1.7 tags: - name: flag description: Everything about the flag diff --git a/swagger_gen/cmd/flagr-server/main.go b/swagger_gen/cmd/flagr-server/main.go index f5b24057..2551dbf1 100644 --- a/swagger_gen/cmd/flagr-server/main.go +++ b/swagger_gen/cmd/flagr-server/main.go @@ -8,7 +8,7 @@ import ( "github.com/checkr/flagr/swagger_gen/restapi" "github.com/checkr/flagr/swagger_gen/restapi/operations" - loads "github.com/go-openapi/loads" + "github.com/go-openapi/loads" flags "github.com/jessevdk/go-flags" ) @@ -29,7 +29,6 @@ func main() { parser := flags.NewParser(server, flags.Default) parser.ShortDescription = "Flagr" parser.LongDescription = "Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\".\n" - server.ConfigureFlags() for _, optsGroup := range api.CommandLineOptionsGroups { _, err := parser.AddGroup(optsGroup.ShortDescription, optsGroup.LongDescription, optsGroup.Options) diff --git a/swagger_gen/models/constraint.go b/swagger_gen/models/constraint.go index 80f1551d..121c04fe 100644 --- a/swagger_gen/models/constraint.go +++ b/swagger_gen/models/constraint.go @@ -8,14 +8,14 @@ package models import ( "encoding/json" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Constraint constraint +// // swagger:model constraint type Constraint struct { diff --git a/swagger_gen/models/create_constraint_request.go b/swagger_gen/models/create_constraint_request.go index 37a90b80..53f75d63 100644 --- a/swagger_gen/models/create_constraint_request.go +++ b/swagger_gen/models/create_constraint_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateConstraintRequest create constraint request +// // swagger:model createConstraintRequest type CreateConstraintRequest struct { diff --git a/swagger_gen/models/create_flag_request.go b/swagger_gen/models/create_flag_request.go index b1dc360b..e76c23c5 100644 --- a/swagger_gen/models/create_flag_request.go +++ b/swagger_gen/models/create_flag_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateFlagRequest create flag request +// // swagger:model createFlagRequest type CreateFlagRequest struct { diff --git a/swagger_gen/models/create_segment_request.go b/swagger_gen/models/create_segment_request.go index d00020cf..f3b9c8c3 100644 --- a/swagger_gen/models/create_segment_request.go +++ b/swagger_gen/models/create_segment_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateSegmentRequest create segment request +// // swagger:model createSegmentRequest type CreateSegmentRequest struct { diff --git a/swagger_gen/models/create_variant_request.go b/swagger_gen/models/create_variant_request.go index 788174cb..fc20eedd 100644 --- a/swagger_gen/models/create_variant_request.go +++ b/swagger_gen/models/create_variant_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // CreateVariantRequest create variant request +// // swagger:model createVariantRequest type CreateVariantRequest struct { diff --git a/swagger_gen/models/distribution.go b/swagger_gen/models/distribution.go index e85aab59..1bc72b58 100644 --- a/swagger_gen/models/distribution.go +++ b/swagger_gen/models/distribution.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Distribution distribution +// // swagger:model distribution type Distribution struct { diff --git a/swagger_gen/models/error.go b/swagger_gen/models/error.go index 4204e6d5..db7fc920 100644 --- a/swagger_gen/models/error.go +++ b/swagger_gen/models/error.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Error error +// // swagger:model error type Error struct { diff --git a/swagger_gen/models/eval_context.go b/swagger_gen/models/eval_context.go index 07a28498..0fe97828 100644 --- a/swagger_gen/models/eval_context.go +++ b/swagger_gen/models/eval_context.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // EvalContext eval context +// // swagger:model evalContext type EvalContext struct { diff --git a/swagger_gen/models/eval_debug_log.go b/swagger_gen/models/eval_debug_log.go index dbb54405..4f4e4d21 100644 --- a/swagger_gen/models/eval_debug_log.go +++ b/swagger_gen/models/eval_debug_log.go @@ -8,13 +8,13 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // EvalDebugLog eval debug log +// // swagger:model evalDebugLog type EvalDebugLog struct { diff --git a/swagger_gen/models/eval_result.go b/swagger_gen/models/eval_result.go index c5c3d31f..df5896d8 100644 --- a/swagger_gen/models/eval_result.go +++ b/swagger_gen/models/eval_result.go @@ -6,13 +6,13 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // EvalResult eval result +// // swagger:model evalResult type EvalResult struct { diff --git a/swagger_gen/models/evaluation_batch_request.go b/swagger_gen/models/evaluation_batch_request.go index 28093107..c819134e 100644 --- a/swagger_gen/models/evaluation_batch_request.go +++ b/swagger_gen/models/evaluation_batch_request.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // EvaluationBatchRequest evaluation batch request +// // swagger:model evaluationBatchRequest type EvaluationBatchRequest struct { diff --git a/swagger_gen/models/evaluation_batch_response.go b/swagger_gen/models/evaluation_batch_response.go index fe3cc98c..05db0a28 100644 --- a/swagger_gen/models/evaluation_batch_response.go +++ b/swagger_gen/models/evaluation_batch_response.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // EvaluationBatchResponse evaluation batch response +// // swagger:model evaluationBatchResponse type EvaluationBatchResponse struct { diff --git a/swagger_gen/models/evaluation_entity.go b/swagger_gen/models/evaluation_entity.go index 2b406963..514333f1 100644 --- a/swagger_gen/models/evaluation_entity.go +++ b/swagger_gen/models/evaluation_entity.go @@ -6,12 +6,12 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // EvaluationEntity evaluation entity +// // swagger:model evaluationEntity type EvaluationEntity struct { diff --git a/swagger_gen/models/flag.go b/swagger_gen/models/flag.go index 7ffdc0c4..0b5559c2 100644 --- a/swagger_gen/models/flag.go +++ b/swagger_gen/models/flag.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Flag flag +// // swagger:model flag type Flag struct { diff --git a/swagger_gen/models/flag_snapshot.go b/swagger_gen/models/flag_snapshot.go index bec9a801..68204870 100644 --- a/swagger_gen/models/flag_snapshot.go +++ b/swagger_gen/models/flag_snapshot.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // FlagSnapshot flag snapshot +// // swagger:model flagSnapshot type FlagSnapshot struct { diff --git a/swagger_gen/models/health.go b/swagger_gen/models/health.go index b4511140..c2345afc 100644 --- a/swagger_gen/models/health.go +++ b/swagger_gen/models/health.go @@ -6,12 +6,12 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" ) // Health health +// // swagger:model health type Health struct { diff --git a/swagger_gen/models/put_distributions_request.go b/swagger_gen/models/put_distributions_request.go index 855c0d56..93f1bee8 100644 --- a/swagger_gen/models/put_distributions_request.go +++ b/swagger_gen/models/put_distributions_request.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutDistributionsRequest put distributions request +// // swagger:model putDistributionsRequest type PutDistributionsRequest struct { diff --git a/swagger_gen/models/put_flag_request.go b/swagger_gen/models/put_flag_request.go index 702b58b7..44681785 100644 --- a/swagger_gen/models/put_flag_request.go +++ b/swagger_gen/models/put_flag_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutFlagRequest put flag request +// // swagger:model putFlagRequest type PutFlagRequest struct { diff --git a/swagger_gen/models/put_segment_reorder_request.go b/swagger_gen/models/put_segment_reorder_request.go index f1e32aad..54d4f4ba 100644 --- a/swagger_gen/models/put_segment_reorder_request.go +++ b/swagger_gen/models/put_segment_reorder_request.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutSegmentReorderRequest put segment reorder request +// // swagger:model putSegmentReorderRequest type PutSegmentReorderRequest struct { diff --git a/swagger_gen/models/put_segment_request.go b/swagger_gen/models/put_segment_request.go index d359d6a0..ad4402c9 100644 --- a/swagger_gen/models/put_segment_request.go +++ b/swagger_gen/models/put_segment_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutSegmentRequest put segment request +// // swagger:model putSegmentRequest type PutSegmentRequest struct { diff --git a/swagger_gen/models/put_variant_request.go b/swagger_gen/models/put_variant_request.go index 3921fabc..8ab1cc7b 100644 --- a/swagger_gen/models/put_variant_request.go +++ b/swagger_gen/models/put_variant_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // PutVariantRequest put variant request +// // swagger:model putVariantRequest type PutVariantRequest struct { diff --git a/swagger_gen/models/segment.go b/swagger_gen/models/segment.go index cb00e9e1..feb4aeac 100644 --- a/swagger_gen/models/segment.go +++ b/swagger_gen/models/segment.go @@ -8,14 +8,14 @@ package models import ( "strconv" - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Segment segment +// // swagger:model segment type Segment struct { diff --git a/swagger_gen/models/segment_debug_log.go b/swagger_gen/models/segment_debug_log.go index 02ddb61c..3cc20636 100644 --- a/swagger_gen/models/segment_debug_log.go +++ b/swagger_gen/models/segment_debug_log.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SegmentDebugLog segment debug log +// // swagger:model segmentDebugLog type SegmentDebugLog struct { diff --git a/swagger_gen/models/set_flag_enabled_request.go b/swagger_gen/models/set_flag_enabled_request.go index 5aee8417..9850d1ee 100644 --- a/swagger_gen/models/set_flag_enabled_request.go +++ b/swagger_gen/models/set_flag_enabled_request.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // SetFlagEnabledRequest set flag enabled request +// // swagger:model setFlagEnabledRequest type SetFlagEnabledRequest struct { diff --git a/swagger_gen/models/variant.go b/swagger_gen/models/variant.go index 7e51b2c9..ddb11b5b 100644 --- a/swagger_gen/models/variant.go +++ b/swagger_gen/models/variant.go @@ -6,14 +6,14 @@ package models // Editing this file might prove futile when you re-run the swagger generate command import ( - strfmt "github.com/go-openapi/strfmt" - "github.com/go-openapi/errors" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" ) // Variant variant +// // swagger:model variant type Variant struct { diff --git a/swagger_gen/restapi/doc.go b/swagger_gen/restapi/doc.go index b7226f2d..386224ed 100644 --- a/swagger_gen/restapi/doc.go +++ b/swagger_gen/restapi/doc.go @@ -1,24 +1,21 @@ // Code generated by go-swagger; DO NOT EDIT. -/* -Package restapi Flagr -Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1". - - - - Schemes: - http - Host: localhost - BasePath: /api/v1 - Version: 1.1.6 - - Consumes: - - application/json - - Produces: - - application/json - - application/octet-stream - -swagger:meta -*/ +// Package restapi Flagr +// +// Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is "/api/v1". +// +// Schemes: +// http +// Host: localhost +// BasePath: /api/v1 +// Version: 1.1.7 +// +// Consumes: +// - application/json +// +// Produces: +// - application/octet-stream +// - application/json +// +// swagger:meta package restapi diff --git a/swagger_gen/restapi/embedded_spec.go b/swagger_gen/restapi/embedded_spec.go index 06d4c941..3127de7d 100644 --- a/swagger_gen/restapi/embedded_spec.go +++ b/swagger_gen/restapi/embedded_spec.go @@ -31,7 +31,7 @@ func init() { "info": { "description": "Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\".\n", "title": "Flagr", - "version": "1.1.6" + "version": "1.1.7" }, "basePath": "/api/v1", "paths": { @@ -1804,7 +1804,7 @@ func init() { "info": { "description": "Flagr is a feature flagging, A/B testing and dynamic configuration microservice. The base path for all the APIs is \"/api/v1\".\n", "title": "Flagr", - "version": "1.1.6" + "version": "1.1.7" }, "basePath": "/api/v1", "paths": { diff --git a/swagger_gen/restapi/operations/constraint/create_constraint.go b/swagger_gen/restapi/operations/constraint/create_constraint.go index 346fcb27..e345c4a1 100644 --- a/swagger_gen/restapi/operations/constraint/create_constraint.go +++ b/swagger_gen/restapi/operations/constraint/create_constraint.go @@ -8,7 +8,7 @@ package constraint import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // CreateConstraintHandlerFunc turns a function with the right signature into a create constraint handler diff --git a/swagger_gen/restapi/operations/constraint/create_constraint_parameters.go b/swagger_gen/restapi/operations/constraint/create_constraint_parameters.go index 6a60c1de..b1306365 100644 --- a/swagger_gen/restapi/operations/constraint/create_constraint_parameters.go +++ b/swagger_gen/restapi/operations/constraint/create_constraint_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewCreateConstraintParams creates a new CreateConstraintParams object diff --git a/swagger_gen/restapi/operations/constraint/create_constraint_responses.go b/swagger_gen/restapi/operations/constraint/create_constraint_responses.go index 60e64cb5..b4317626 100644 --- a/swagger_gen/restapi/operations/constraint/create_constraint_responses.go +++ b/swagger_gen/restapi/operations/constraint/create_constraint_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // CreateConstraintOKCode is the HTTP code returned for type CreateConstraintOK diff --git a/swagger_gen/restapi/operations/constraint/delete_constraint.go b/swagger_gen/restapi/operations/constraint/delete_constraint.go index 04b9b30f..517de5c0 100644 --- a/swagger_gen/restapi/operations/constraint/delete_constraint.go +++ b/swagger_gen/restapi/operations/constraint/delete_constraint.go @@ -8,7 +8,7 @@ package constraint import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // DeleteConstraintHandlerFunc turns a function with the right signature into a delete constraint handler diff --git a/swagger_gen/restapi/operations/constraint/delete_constraint_parameters.go b/swagger_gen/restapi/operations/constraint/delete_constraint_parameters.go index caab5f14..4089216d 100644 --- a/swagger_gen/restapi/operations/constraint/delete_constraint_parameters.go +++ b/swagger_gen/restapi/operations/constraint/delete_constraint_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewDeleteConstraintParams creates a new DeleteConstraintParams object diff --git a/swagger_gen/restapi/operations/constraint/delete_constraint_responses.go b/swagger_gen/restapi/operations/constraint/delete_constraint_responses.go index d945b60c..73545a37 100644 --- a/swagger_gen/restapi/operations/constraint/delete_constraint_responses.go +++ b/swagger_gen/restapi/operations/constraint/delete_constraint_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // DeleteConstraintOKCode is the HTTP code returned for type DeleteConstraintOK diff --git a/swagger_gen/restapi/operations/constraint/find_constraints.go b/swagger_gen/restapi/operations/constraint/find_constraints.go index f62e2fc8..12d9ed59 100644 --- a/swagger_gen/restapi/operations/constraint/find_constraints.go +++ b/swagger_gen/restapi/operations/constraint/find_constraints.go @@ -8,7 +8,7 @@ package constraint import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // FindConstraintsHandlerFunc turns a function with the right signature into a find constraints handler diff --git a/swagger_gen/restapi/operations/constraint/find_constraints_parameters.go b/swagger_gen/restapi/operations/constraint/find_constraints_parameters.go index 678f98b3..31b403ce 100644 --- a/swagger_gen/restapi/operations/constraint/find_constraints_parameters.go +++ b/swagger_gen/restapi/operations/constraint/find_constraints_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewFindConstraintsParams creates a new FindConstraintsParams object diff --git a/swagger_gen/restapi/operations/constraint/find_constraints_responses.go b/swagger_gen/restapi/operations/constraint/find_constraints_responses.go index 87e84f44..1a8a2d7f 100644 --- a/swagger_gen/restapi/operations/constraint/find_constraints_responses.go +++ b/swagger_gen/restapi/operations/constraint/find_constraints_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // FindConstraintsOKCode is the HTTP code returned for type FindConstraintsOK diff --git a/swagger_gen/restapi/operations/constraint/put_constraint.go b/swagger_gen/restapi/operations/constraint/put_constraint.go index c8e8fe8c..c98143ee 100644 --- a/swagger_gen/restapi/operations/constraint/put_constraint.go +++ b/swagger_gen/restapi/operations/constraint/put_constraint.go @@ -8,7 +8,7 @@ package constraint import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutConstraintHandlerFunc turns a function with the right signature into a put constraint handler diff --git a/swagger_gen/restapi/operations/constraint/put_constraint_parameters.go b/swagger_gen/restapi/operations/constraint/put_constraint_parameters.go index 739911f1..94b827ce 100644 --- a/swagger_gen/restapi/operations/constraint/put_constraint_parameters.go +++ b/swagger_gen/restapi/operations/constraint/put_constraint_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutConstraintParams creates a new PutConstraintParams object diff --git a/swagger_gen/restapi/operations/constraint/put_constraint_responses.go b/swagger_gen/restapi/operations/constraint/put_constraint_responses.go index e630ed33..e703a642 100644 --- a/swagger_gen/restapi/operations/constraint/put_constraint_responses.go +++ b/swagger_gen/restapi/operations/constraint/put_constraint_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutConstraintOKCode is the HTTP code returned for type PutConstraintOK diff --git a/swagger_gen/restapi/operations/distribution/find_distributions.go b/swagger_gen/restapi/operations/distribution/find_distributions.go index 8c64bf33..8e76b48f 100644 --- a/swagger_gen/restapi/operations/distribution/find_distributions.go +++ b/swagger_gen/restapi/operations/distribution/find_distributions.go @@ -8,7 +8,7 @@ package distribution import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // FindDistributionsHandlerFunc turns a function with the right signature into a find distributions handler diff --git a/swagger_gen/restapi/operations/distribution/find_distributions_parameters.go b/swagger_gen/restapi/operations/distribution/find_distributions_parameters.go index ae15240a..d4b76c34 100644 --- a/swagger_gen/restapi/operations/distribution/find_distributions_parameters.go +++ b/swagger_gen/restapi/operations/distribution/find_distributions_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewFindDistributionsParams creates a new FindDistributionsParams object diff --git a/swagger_gen/restapi/operations/distribution/find_distributions_responses.go b/swagger_gen/restapi/operations/distribution/find_distributions_responses.go index 25f7ae5d..c82ee4aa 100644 --- a/swagger_gen/restapi/operations/distribution/find_distributions_responses.go +++ b/swagger_gen/restapi/operations/distribution/find_distributions_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // FindDistributionsOKCode is the HTTP code returned for type FindDistributionsOK diff --git a/swagger_gen/restapi/operations/distribution/put_distributions.go b/swagger_gen/restapi/operations/distribution/put_distributions.go index 656b40d9..23a33e35 100644 --- a/swagger_gen/restapi/operations/distribution/put_distributions.go +++ b/swagger_gen/restapi/operations/distribution/put_distributions.go @@ -8,7 +8,7 @@ package distribution import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutDistributionsHandlerFunc turns a function with the right signature into a put distributions handler diff --git a/swagger_gen/restapi/operations/distribution/put_distributions_parameters.go b/swagger_gen/restapi/operations/distribution/put_distributions_parameters.go index 90fe64c3..6a1b2d43 100644 --- a/swagger_gen/restapi/operations/distribution/put_distributions_parameters.go +++ b/swagger_gen/restapi/operations/distribution/put_distributions_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutDistributionsParams creates a new PutDistributionsParams object diff --git a/swagger_gen/restapi/operations/distribution/put_distributions_responses.go b/swagger_gen/restapi/operations/distribution/put_distributions_responses.go index eff832c7..c9198325 100644 --- a/swagger_gen/restapi/operations/distribution/put_distributions_responses.go +++ b/swagger_gen/restapi/operations/distribution/put_distributions_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutDistributionsOKCode is the HTTP code returned for type PutDistributionsOK diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation.go b/swagger_gen/restapi/operations/evaluation/post_evaluation.go index 8bc3139a..3bcb2605 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation.go @@ -8,7 +8,7 @@ package evaluation import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PostEvaluationHandlerFunc turns a function with the right signature into a post evaluation handler diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch.go b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch.go index 4a7d3fb5..dceaf60a 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch.go @@ -8,7 +8,7 @@ package evaluation import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PostEvaluationBatchHandlerFunc turns a function with the right signature into a post evaluation batch handler diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_parameters.go b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_parameters.go index 7d33f9ca..327edc6b 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_parameters.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_parameters.go @@ -13,7 +13,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPostEvaluationBatchParams creates a new PostEvaluationBatchParams object diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_responses.go b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_responses.go index f98c50d2..8a98ee7a 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_responses.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation_batch_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PostEvaluationBatchOKCode is the HTTP code returned for type PostEvaluationBatchOK diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation_parameters.go b/swagger_gen/restapi/operations/evaluation/post_evaluation_parameters.go index 685df1ea..5a098a21 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation_parameters.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation_parameters.go @@ -13,7 +13,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPostEvaluationParams creates a new PostEvaluationParams object diff --git a/swagger_gen/restapi/operations/evaluation/post_evaluation_responses.go b/swagger_gen/restapi/operations/evaluation/post_evaluation_responses.go index 0b407028..a82b4751 100644 --- a/swagger_gen/restapi/operations/evaluation/post_evaluation_responses.go +++ b/swagger_gen/restapi/operations/evaluation/post_evaluation_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PostEvaluationOKCode is the HTTP code returned for type PostEvaluationOK diff --git a/swagger_gen/restapi/operations/export/get_export_eval_cache_json.go b/swagger_gen/restapi/operations/export/get_export_eval_cache_json.go index 73ae7b8c..1319f666 100644 --- a/swagger_gen/restapi/operations/export/get_export_eval_cache_json.go +++ b/swagger_gen/restapi/operations/export/get_export_eval_cache_json.go @@ -8,7 +8,7 @@ package export import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetExportEvalCacheJSONHandlerFunc turns a function with the right signature into a get export eval cache JSON handler diff --git a/swagger_gen/restapi/operations/export/get_export_eval_cache_json_responses.go b/swagger_gen/restapi/operations/export/get_export_eval_cache_json_responses.go index 2e335562..73106c10 100644 --- a/swagger_gen/restapi/operations/export/get_export_eval_cache_json_responses.go +++ b/swagger_gen/restapi/operations/export/get_export_eval_cache_json_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetExportEvalCacheJSONOKCode is the HTTP code returned for type GetExportEvalCacheJSONOK diff --git a/swagger_gen/restapi/operations/export/get_export_sqlite.go b/swagger_gen/restapi/operations/export/get_export_sqlite.go index 3e10f421..4e2095dd 100644 --- a/swagger_gen/restapi/operations/export/get_export_sqlite.go +++ b/swagger_gen/restapi/operations/export/get_export_sqlite.go @@ -8,7 +8,7 @@ package export import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetExportSqliteHandlerFunc turns a function with the right signature into a get export sqlite handler diff --git a/swagger_gen/restapi/operations/export/get_export_sqlite_responses.go b/swagger_gen/restapi/operations/export/get_export_sqlite_responses.go index dd33183c..e9720536 100644 --- a/swagger_gen/restapi/operations/export/get_export_sqlite_responses.go +++ b/swagger_gen/restapi/operations/export/get_export_sqlite_responses.go @@ -11,7 +11,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetExportSqliteOKCode is the HTTP code returned for type GetExportSqliteOK diff --git a/swagger_gen/restapi/operations/flag/create_flag.go b/swagger_gen/restapi/operations/flag/create_flag.go index de6d5d20..e50a7cb0 100644 --- a/swagger_gen/restapi/operations/flag/create_flag.go +++ b/swagger_gen/restapi/operations/flag/create_flag.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // CreateFlagHandlerFunc turns a function with the right signature into a create flag handler diff --git a/swagger_gen/restapi/operations/flag/create_flag_parameters.go b/swagger_gen/restapi/operations/flag/create_flag_parameters.go index 7e9ce642..c27d57d5 100644 --- a/swagger_gen/restapi/operations/flag/create_flag_parameters.go +++ b/swagger_gen/restapi/operations/flag/create_flag_parameters.go @@ -13,7 +13,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewCreateFlagParams creates a new CreateFlagParams object diff --git a/swagger_gen/restapi/operations/flag/create_flag_responses.go b/swagger_gen/restapi/operations/flag/create_flag_responses.go index 5e9cd928..1cdbaae3 100644 --- a/swagger_gen/restapi/operations/flag/create_flag_responses.go +++ b/swagger_gen/restapi/operations/flag/create_flag_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // CreateFlagOKCode is the HTTP code returned for type CreateFlagOK diff --git a/swagger_gen/restapi/operations/flag/delete_flag.go b/swagger_gen/restapi/operations/flag/delete_flag.go index f6f5a476..edf77bb5 100644 --- a/swagger_gen/restapi/operations/flag/delete_flag.go +++ b/swagger_gen/restapi/operations/flag/delete_flag.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // DeleteFlagHandlerFunc turns a function with the right signature into a delete flag handler diff --git a/swagger_gen/restapi/operations/flag/delete_flag_parameters.go b/swagger_gen/restapi/operations/flag/delete_flag_parameters.go index 55db8656..9869421f 100644 --- a/swagger_gen/restapi/operations/flag/delete_flag_parameters.go +++ b/swagger_gen/restapi/operations/flag/delete_flag_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewDeleteFlagParams creates a new DeleteFlagParams object diff --git a/swagger_gen/restapi/operations/flag/delete_flag_responses.go b/swagger_gen/restapi/operations/flag/delete_flag_responses.go index fa8766c8..0e785926 100644 --- a/swagger_gen/restapi/operations/flag/delete_flag_responses.go +++ b/swagger_gen/restapi/operations/flag/delete_flag_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // DeleteFlagOKCode is the HTTP code returned for type DeleteFlagOK diff --git a/swagger_gen/restapi/operations/flag/find_flags.go b/swagger_gen/restapi/operations/flag/find_flags.go index e3b705eb..3d26a4f4 100644 --- a/swagger_gen/restapi/operations/flag/find_flags.go +++ b/swagger_gen/restapi/operations/flag/find_flags.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // FindFlagsHandlerFunc turns a function with the right signature into a find flags handler diff --git a/swagger_gen/restapi/operations/flag/find_flags_parameters.go b/swagger_gen/restapi/operations/flag/find_flags_parameters.go index 57a66a40..69b31282 100644 --- a/swagger_gen/restapi/operations/flag/find_flags_parameters.go +++ b/swagger_gen/restapi/operations/flag/find_flags_parameters.go @@ -11,9 +11,8 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" - - strfmt "github.com/go-openapi/strfmt" ) // NewFindFlagsParams creates a new FindFlagsParams object diff --git a/swagger_gen/restapi/operations/flag/find_flags_responses.go b/swagger_gen/restapi/operations/flag/find_flags_responses.go index 7efda3f7..695e489e 100644 --- a/swagger_gen/restapi/operations/flag/find_flags_responses.go +++ b/swagger_gen/restapi/operations/flag/find_flags_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // FindFlagsOKCode is the HTTP code returned for type FindFlagsOK diff --git a/swagger_gen/restapi/operations/flag/get_flag.go b/swagger_gen/restapi/operations/flag/get_flag.go index 1036b0b0..25843a65 100644 --- a/swagger_gen/restapi/operations/flag/get_flag.go +++ b/swagger_gen/restapi/operations/flag/get_flag.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetFlagHandlerFunc turns a function with the right signature into a get flag handler diff --git a/swagger_gen/restapi/operations/flag/get_flag_entity_types.go b/swagger_gen/restapi/operations/flag/get_flag_entity_types.go index 6f50c4b2..ec7216d8 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_entity_types.go +++ b/swagger_gen/restapi/operations/flag/get_flag_entity_types.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetFlagEntityTypesHandlerFunc turns a function with the right signature into a get flag entity types handler diff --git a/swagger_gen/restapi/operations/flag/get_flag_entity_types_responses.go b/swagger_gen/restapi/operations/flag/get_flag_entity_types_responses.go index ceb4c780..09792941 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_entity_types_responses.go +++ b/swagger_gen/restapi/operations/flag/get_flag_entity_types_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetFlagEntityTypesOKCode is the HTTP code returned for type GetFlagEntityTypesOK diff --git a/swagger_gen/restapi/operations/flag/get_flag_parameters.go b/swagger_gen/restapi/operations/flag/get_flag_parameters.go index c36becd4..46893d68 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_parameters.go +++ b/swagger_gen/restapi/operations/flag/get_flag_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewGetFlagParams creates a new GetFlagParams object diff --git a/swagger_gen/restapi/operations/flag/get_flag_responses.go b/swagger_gen/restapi/operations/flag/get_flag_responses.go index 2767e9a0..7214dc9a 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_responses.go +++ b/swagger_gen/restapi/operations/flag/get_flag_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetFlagOKCode is the HTTP code returned for type GetFlagOK diff --git a/swagger_gen/restapi/operations/flag/get_flag_snapshots.go b/swagger_gen/restapi/operations/flag/get_flag_snapshots.go index 89108a6e..57dfd1a1 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_snapshots.go +++ b/swagger_gen/restapi/operations/flag/get_flag_snapshots.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetFlagSnapshotsHandlerFunc turns a function with the right signature into a get flag snapshots handler diff --git a/swagger_gen/restapi/operations/flag/get_flag_snapshots_parameters.go b/swagger_gen/restapi/operations/flag/get_flag_snapshots_parameters.go index da5faebb..47830c9c 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_snapshots_parameters.go +++ b/swagger_gen/restapi/operations/flag/get_flag_snapshots_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewGetFlagSnapshotsParams creates a new GetFlagSnapshotsParams object diff --git a/swagger_gen/restapi/operations/flag/get_flag_snapshots_responses.go b/swagger_gen/restapi/operations/flag/get_flag_snapshots_responses.go index 99a57503..0187c109 100644 --- a/swagger_gen/restapi/operations/flag/get_flag_snapshots_responses.go +++ b/swagger_gen/restapi/operations/flag/get_flag_snapshots_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetFlagSnapshotsOKCode is the HTTP code returned for type GetFlagSnapshotsOK diff --git a/swagger_gen/restapi/operations/flag/put_flag.go b/swagger_gen/restapi/operations/flag/put_flag.go index 679e8848..fd10ed5e 100644 --- a/swagger_gen/restapi/operations/flag/put_flag.go +++ b/swagger_gen/restapi/operations/flag/put_flag.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutFlagHandlerFunc turns a function with the right signature into a put flag handler diff --git a/swagger_gen/restapi/operations/flag/put_flag_parameters.go b/swagger_gen/restapi/operations/flag/put_flag_parameters.go index 6ebe6409..641dc66e 100644 --- a/swagger_gen/restapi/operations/flag/put_flag_parameters.go +++ b/swagger_gen/restapi/operations/flag/put_flag_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutFlagParams creates a new PutFlagParams object diff --git a/swagger_gen/restapi/operations/flag/put_flag_responses.go b/swagger_gen/restapi/operations/flag/put_flag_responses.go index 70d0e69e..e1e4b112 100644 --- a/swagger_gen/restapi/operations/flag/put_flag_responses.go +++ b/swagger_gen/restapi/operations/flag/put_flag_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutFlagOKCode is the HTTP code returned for type PutFlagOK diff --git a/swagger_gen/restapi/operations/flag/set_flag_enabled.go b/swagger_gen/restapi/operations/flag/set_flag_enabled.go index 5e42387c..ea20e5d1 100644 --- a/swagger_gen/restapi/operations/flag/set_flag_enabled.go +++ b/swagger_gen/restapi/operations/flag/set_flag_enabled.go @@ -8,7 +8,7 @@ package flag import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // SetFlagEnabledHandlerFunc turns a function with the right signature into a set flag enabled handler diff --git a/swagger_gen/restapi/operations/flag/set_flag_enabled_parameters.go b/swagger_gen/restapi/operations/flag/set_flag_enabled_parameters.go index c6c36ad9..a733322f 100644 --- a/swagger_gen/restapi/operations/flag/set_flag_enabled_parameters.go +++ b/swagger_gen/restapi/operations/flag/set_flag_enabled_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewSetFlagEnabledParams creates a new SetFlagEnabledParams object diff --git a/swagger_gen/restapi/operations/flag/set_flag_enabled_responses.go b/swagger_gen/restapi/operations/flag/set_flag_enabled_responses.go index 238d8bb5..3fc318b2 100644 --- a/swagger_gen/restapi/operations/flag/set_flag_enabled_responses.go +++ b/swagger_gen/restapi/operations/flag/set_flag_enabled_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // SetFlagEnabledOKCode is the HTTP code returned for type SetFlagEnabledOK diff --git a/swagger_gen/restapi/operations/flagr_api.go b/swagger_gen/restapi/operations/flagr_api.go index fab36523..9b8c776a 100644 --- a/swagger_gen/restapi/operations/flagr_api.go +++ b/swagger_gen/restapi/operations/flagr_api.go @@ -10,13 +10,13 @@ import ( "net/http" "strings" - errors "github.com/go-openapi/errors" - loads "github.com/go-openapi/loads" - runtime "github.com/go-openapi/runtime" - middleware "github.com/go-openapi/runtime/middleware" - security "github.com/go-openapi/runtime/security" - spec "github.com/go-openapi/spec" - strfmt "github.com/go-openapi/strfmt" + "github.com/go-openapi/errors" + "github.com/go-openapi/loads" + "github.com/go-openapi/runtime" + "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/security" + "github.com/go-openapi/spec" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/checkr/flagr/swagger_gen/restapi/operations/constraint" @@ -38,98 +38,102 @@ func NewFlagrAPI(spec *loads.Document) *FlagrAPI { defaultProduces: "application/json", customConsumers: make(map[string]runtime.Consumer), customProducers: make(map[string]runtime.Producer), + PreServerShutdown: func() {}, ServerShutdown: func() {}, spec: spec, ServeError: errors.ServeError, BasicAuthenticator: security.BasicAuth, APIKeyAuthenticator: security.APIKeyAuth, BearerAuthenticator: security.BearerAuth, - JSONConsumer: runtime.JSONConsumer(), - JSONProducer: runtime.JSONProducer(), - BinProducer: runtime.ByteStreamProducer(), + + JSONConsumer: runtime.JSONConsumer(), + + BinProducer: runtime.ByteStreamProducer(), + JSONProducer: runtime.JSONProducer(), + ConstraintCreateConstraintHandler: constraint.CreateConstraintHandlerFunc(func(params constraint.CreateConstraintParams) middleware.Responder { - return middleware.NotImplemented("operation ConstraintCreateConstraint has not yet been implemented") + return middleware.NotImplemented("operation constraint.CreateConstraint has not yet been implemented") }), FlagCreateFlagHandler: flag.CreateFlagHandlerFunc(func(params flag.CreateFlagParams) middleware.Responder { - return middleware.NotImplemented("operation FlagCreateFlag has not yet been implemented") + return middleware.NotImplemented("operation flag.CreateFlag has not yet been implemented") }), SegmentCreateSegmentHandler: segment.CreateSegmentHandlerFunc(func(params segment.CreateSegmentParams) middleware.Responder { - return middleware.NotImplemented("operation SegmentCreateSegment has not yet been implemented") + return middleware.NotImplemented("operation segment.CreateSegment has not yet been implemented") }), VariantCreateVariantHandler: variant.CreateVariantHandlerFunc(func(params variant.CreateVariantParams) middleware.Responder { - return middleware.NotImplemented("operation VariantCreateVariant has not yet been implemented") + return middleware.NotImplemented("operation variant.CreateVariant has not yet been implemented") }), ConstraintDeleteConstraintHandler: constraint.DeleteConstraintHandlerFunc(func(params constraint.DeleteConstraintParams) middleware.Responder { - return middleware.NotImplemented("operation ConstraintDeleteConstraint has not yet been implemented") + return middleware.NotImplemented("operation constraint.DeleteConstraint has not yet been implemented") }), FlagDeleteFlagHandler: flag.DeleteFlagHandlerFunc(func(params flag.DeleteFlagParams) middleware.Responder { - return middleware.NotImplemented("operation FlagDeleteFlag has not yet been implemented") + return middleware.NotImplemented("operation flag.DeleteFlag has not yet been implemented") }), SegmentDeleteSegmentHandler: segment.DeleteSegmentHandlerFunc(func(params segment.DeleteSegmentParams) middleware.Responder { - return middleware.NotImplemented("operation SegmentDeleteSegment has not yet been implemented") + return middleware.NotImplemented("operation segment.DeleteSegment has not yet been implemented") }), VariantDeleteVariantHandler: variant.DeleteVariantHandlerFunc(func(params variant.DeleteVariantParams) middleware.Responder { - return middleware.NotImplemented("operation VariantDeleteVariant has not yet been implemented") + return middleware.NotImplemented("operation variant.DeleteVariant has not yet been implemented") }), ConstraintFindConstraintsHandler: constraint.FindConstraintsHandlerFunc(func(params constraint.FindConstraintsParams) middleware.Responder { - return middleware.NotImplemented("operation ConstraintFindConstraints has not yet been implemented") + return middleware.NotImplemented("operation constraint.FindConstraints has not yet been implemented") }), DistributionFindDistributionsHandler: distribution.FindDistributionsHandlerFunc(func(params distribution.FindDistributionsParams) middleware.Responder { - return middleware.NotImplemented("operation DistributionFindDistributions has not yet been implemented") + return middleware.NotImplemented("operation distribution.FindDistributions has not yet been implemented") }), FlagFindFlagsHandler: flag.FindFlagsHandlerFunc(func(params flag.FindFlagsParams) middleware.Responder { - return middleware.NotImplemented("operation FlagFindFlags has not yet been implemented") + return middleware.NotImplemented("operation flag.FindFlags has not yet been implemented") }), SegmentFindSegmentsHandler: segment.FindSegmentsHandlerFunc(func(params segment.FindSegmentsParams) middleware.Responder { - return middleware.NotImplemented("operation SegmentFindSegments has not yet been implemented") + return middleware.NotImplemented("operation segment.FindSegments has not yet been implemented") }), VariantFindVariantsHandler: variant.FindVariantsHandlerFunc(func(params variant.FindVariantsParams) middleware.Responder { - return middleware.NotImplemented("operation VariantFindVariants has not yet been implemented") + return middleware.NotImplemented("operation variant.FindVariants has not yet been implemented") }), ExportGetExportEvalCacheJSONHandler: export.GetExportEvalCacheJSONHandlerFunc(func(params export.GetExportEvalCacheJSONParams) middleware.Responder { - return middleware.NotImplemented("operation ExportGetExportEvalCacheJSON has not yet been implemented") + return middleware.NotImplemented("operation export.GetExportEvalCacheJSON has not yet been implemented") }), ExportGetExportSqliteHandler: export.GetExportSqliteHandlerFunc(func(params export.GetExportSqliteParams) middleware.Responder { - return middleware.NotImplemented("operation ExportGetExportSqlite has not yet been implemented") + return middleware.NotImplemented("operation export.GetExportSqlite has not yet been implemented") }), FlagGetFlagHandler: flag.GetFlagHandlerFunc(func(params flag.GetFlagParams) middleware.Responder { - return middleware.NotImplemented("operation FlagGetFlag has not yet been implemented") + return middleware.NotImplemented("operation flag.GetFlag has not yet been implemented") }), FlagGetFlagEntityTypesHandler: flag.GetFlagEntityTypesHandlerFunc(func(params flag.GetFlagEntityTypesParams) middleware.Responder { - return middleware.NotImplemented("operation FlagGetFlagEntityTypes has not yet been implemented") + return middleware.NotImplemented("operation flag.GetFlagEntityTypes has not yet been implemented") }), FlagGetFlagSnapshotsHandler: flag.GetFlagSnapshotsHandlerFunc(func(params flag.GetFlagSnapshotsParams) middleware.Responder { - return middleware.NotImplemented("operation FlagGetFlagSnapshots has not yet been implemented") + return middleware.NotImplemented("operation flag.GetFlagSnapshots has not yet been implemented") }), HealthGetHealthHandler: health.GetHealthHandlerFunc(func(params health.GetHealthParams) middleware.Responder { - return middleware.NotImplemented("operation HealthGetHealth has not yet been implemented") + return middleware.NotImplemented("operation health.GetHealth has not yet been implemented") }), EvaluationPostEvaluationHandler: evaluation.PostEvaluationHandlerFunc(func(params evaluation.PostEvaluationParams) middleware.Responder { - return middleware.NotImplemented("operation EvaluationPostEvaluation has not yet been implemented") + return middleware.NotImplemented("operation evaluation.PostEvaluation has not yet been implemented") }), EvaluationPostEvaluationBatchHandler: evaluation.PostEvaluationBatchHandlerFunc(func(params evaluation.PostEvaluationBatchParams) middleware.Responder { - return middleware.NotImplemented("operation EvaluationPostEvaluationBatch has not yet been implemented") + return middleware.NotImplemented("operation evaluation.PostEvaluationBatch has not yet been implemented") }), ConstraintPutConstraintHandler: constraint.PutConstraintHandlerFunc(func(params constraint.PutConstraintParams) middleware.Responder { - return middleware.NotImplemented("operation ConstraintPutConstraint has not yet been implemented") + return middleware.NotImplemented("operation constraint.PutConstraint has not yet been implemented") }), DistributionPutDistributionsHandler: distribution.PutDistributionsHandlerFunc(func(params distribution.PutDistributionsParams) middleware.Responder { - return middleware.NotImplemented("operation DistributionPutDistributions has not yet been implemented") + return middleware.NotImplemented("operation distribution.PutDistributions has not yet been implemented") }), FlagPutFlagHandler: flag.PutFlagHandlerFunc(func(params flag.PutFlagParams) middleware.Responder { - return middleware.NotImplemented("operation FlagPutFlag has not yet been implemented") + return middleware.NotImplemented("operation flag.PutFlag has not yet been implemented") }), SegmentPutSegmentHandler: segment.PutSegmentHandlerFunc(func(params segment.PutSegmentParams) middleware.Responder { - return middleware.NotImplemented("operation SegmentPutSegment has not yet been implemented") + return middleware.NotImplemented("operation segment.PutSegment has not yet been implemented") }), SegmentPutSegmentsReorderHandler: segment.PutSegmentsReorderHandlerFunc(func(params segment.PutSegmentsReorderParams) middleware.Responder { - return middleware.NotImplemented("operation SegmentPutSegmentsReorder has not yet been implemented") + return middleware.NotImplemented("operation segment.PutSegmentsReorder has not yet been implemented") }), VariantPutVariantHandler: variant.PutVariantHandlerFunc(func(params variant.PutVariantParams) middleware.Responder { - return middleware.NotImplemented("operation VariantPutVariant has not yet been implemented") + return middleware.NotImplemented("operation variant.PutVariant has not yet been implemented") }), FlagSetFlagEnabledHandler: flag.SetFlagEnabledHandlerFunc(func(params flag.SetFlagEnabledParams) middleware.Responder { - return middleware.NotImplemented("operation FlagSetFlagEnabled has not yet been implemented") + return middleware.NotImplemented("operation flag.SetFlagEnabled has not yet been implemented") }), } } @@ -157,13 +161,16 @@ type FlagrAPI struct { // It has a default implementation in the security package, however you can replace it for your particular usage. BearerAuthenticator func(string, security.ScopedTokenAuthentication) runtime.Authenticator - // JSONConsumer registers a consumer for a "application/json" mime type + // JSONConsumer registers a consumer for the following mime types: + // - application/json JSONConsumer runtime.Consumer - // JSONProducer registers a producer for a "application/json" mime type - JSONProducer runtime.Producer - // BinProducer registers a producer for a "application/octet-stream" mime type + // BinProducer registers a producer for the following mime types: + // - application/octet-stream BinProducer runtime.Producer + // JSONProducer registers a producer for the following mime types: + // - application/json + JSONProducer runtime.Producer // ConstraintCreateConstraintHandler sets the operation handler for the create constraint operation ConstraintCreateConstraintHandler constraint.CreateConstraintHandler @@ -221,11 +228,14 @@ type FlagrAPI struct { VariantPutVariantHandler variant.PutVariantHandler // FlagSetFlagEnabledHandler sets the operation handler for the set flag enabled operation FlagSetFlagEnabledHandler flag.SetFlagEnabledHandler - // ServeError is called when an error is received, there is a default handler // but you can set your own with this ServeError func(http.ResponseWriter, *http.Request, error) + // PreServerShutdown is called before the HTTP(S) server is shutdown + // This allows for custom functions to get executed before the HTTP(S) server stops accepting traffic + PreServerShutdown func() + // ServerShutdown is called when the HTTP(S) server is shut down and done // handling all active connections and does not accept connections any more ServerShutdown func() @@ -280,122 +290,94 @@ func (o *FlagrAPI) Validate() error { unregistered = append(unregistered, "JSONConsumer") } - if o.JSONProducer == nil { - unregistered = append(unregistered, "JSONProducer") - } - if o.BinProducer == nil { unregistered = append(unregistered, "BinProducer") } + if o.JSONProducer == nil { + unregistered = append(unregistered, "JSONProducer") + } if o.ConstraintCreateConstraintHandler == nil { unregistered = append(unregistered, "constraint.CreateConstraintHandler") } - if o.FlagCreateFlagHandler == nil { unregistered = append(unregistered, "flag.CreateFlagHandler") } - if o.SegmentCreateSegmentHandler == nil { unregistered = append(unregistered, "segment.CreateSegmentHandler") } - if o.VariantCreateVariantHandler == nil { unregistered = append(unregistered, "variant.CreateVariantHandler") } - if o.ConstraintDeleteConstraintHandler == nil { unregistered = append(unregistered, "constraint.DeleteConstraintHandler") } - if o.FlagDeleteFlagHandler == nil { unregistered = append(unregistered, "flag.DeleteFlagHandler") } - if o.SegmentDeleteSegmentHandler == nil { unregistered = append(unregistered, "segment.DeleteSegmentHandler") } - if o.VariantDeleteVariantHandler == nil { unregistered = append(unregistered, "variant.DeleteVariantHandler") } - if o.ConstraintFindConstraintsHandler == nil { unregistered = append(unregistered, "constraint.FindConstraintsHandler") } - if o.DistributionFindDistributionsHandler == nil { unregistered = append(unregistered, "distribution.FindDistributionsHandler") } - if o.FlagFindFlagsHandler == nil { unregistered = append(unregistered, "flag.FindFlagsHandler") } - if o.SegmentFindSegmentsHandler == nil { unregistered = append(unregistered, "segment.FindSegmentsHandler") } - if o.VariantFindVariantsHandler == nil { unregistered = append(unregistered, "variant.FindVariantsHandler") } - if o.ExportGetExportEvalCacheJSONHandler == nil { unregistered = append(unregistered, "export.GetExportEvalCacheJSONHandler") } - if o.ExportGetExportSqliteHandler == nil { unregistered = append(unregistered, "export.GetExportSqliteHandler") } - if o.FlagGetFlagHandler == nil { unregistered = append(unregistered, "flag.GetFlagHandler") } - if o.FlagGetFlagEntityTypesHandler == nil { unregistered = append(unregistered, "flag.GetFlagEntityTypesHandler") } - if o.FlagGetFlagSnapshotsHandler == nil { unregistered = append(unregistered, "flag.GetFlagSnapshotsHandler") } - if o.HealthGetHealthHandler == nil { unregistered = append(unregistered, "health.GetHealthHandler") } - if o.EvaluationPostEvaluationHandler == nil { unregistered = append(unregistered, "evaluation.PostEvaluationHandler") } - if o.EvaluationPostEvaluationBatchHandler == nil { unregistered = append(unregistered, "evaluation.PostEvaluationBatchHandler") } - if o.ConstraintPutConstraintHandler == nil { unregistered = append(unregistered, "constraint.PutConstraintHandler") } - if o.DistributionPutDistributionsHandler == nil { unregistered = append(unregistered, "distribution.PutDistributionsHandler") } - if o.FlagPutFlagHandler == nil { unregistered = append(unregistered, "flag.PutFlagHandler") } - if o.SegmentPutSegmentHandler == nil { unregistered = append(unregistered, "segment.PutSegmentHandler") } - if o.SegmentPutSegmentsReorderHandler == nil { unregistered = append(unregistered, "segment.PutSegmentsReorderHandler") } - if o.VariantPutVariantHandler == nil { unregistered = append(unregistered, "variant.PutVariantHandler") } - if o.FlagSetFlagEnabledHandler == nil { unregistered = append(unregistered, "flag.SetFlagEnabledHandler") } @@ -414,28 +396,22 @@ func (o *FlagrAPI) ServeErrorFor(operationID string) func(http.ResponseWriter, * // AuthenticatorsFor gets the authenticators for the specified security schemes func (o *FlagrAPI) AuthenticatorsFor(schemes map[string]spec.SecurityScheme) map[string]runtime.Authenticator { - return nil - } // Authorizer returns the registered authorizer func (o *FlagrAPI) Authorizer() runtime.Authorizer { - return nil - } -// ConsumersFor gets the consumers for the specified media types +// ConsumersFor gets the consumers for the specified media types. +// MIME type parameters are ignored here. func (o *FlagrAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer { - - result := make(map[string]runtime.Consumer) + result := make(map[string]runtime.Consumer, len(mediaTypes)) for _, mt := range mediaTypes { switch mt { - case "application/json": result["application/json"] = o.JSONConsumer - } if c, ok := o.customConsumers[mt]; ok { @@ -443,22 +419,18 @@ func (o *FlagrAPI) ConsumersFor(mediaTypes []string) map[string]runtime.Consumer } } return result - } -// ProducersFor gets the producers for the specified media types +// ProducersFor gets the producers for the specified media types. +// MIME type parameters are ignored here. func (o *FlagrAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer { - - result := make(map[string]runtime.Producer) + result := make(map[string]runtime.Producer, len(mediaTypes)) for _, mt := range mediaTypes { switch mt { - - case "application/json": - result["application/json"] = o.JSONProducer - case "application/octet-stream": result["application/octet-stream"] = o.BinProducer - + case "application/json": + result["application/json"] = o.JSONProducer } if p, ok := o.customProducers[mt]; ok { @@ -466,7 +438,6 @@ func (o *FlagrAPI) ProducersFor(mediaTypes []string) map[string]runtime.Producer } } return result - } // HandlerFor gets a http.Handler for the provided operation method and path @@ -496,7 +467,6 @@ func (o *FlagrAPI) Context() *middleware.Context { func (o *FlagrAPI) initHandlerCache() { o.Context() // don't care about the result, just that the initialization happened - if o.handlers == nil { o.handlers = make(map[string]map[string]http.Handler) } @@ -505,142 +475,114 @@ func (o *FlagrAPI) initHandlerCache() { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/flags/{flagID}/segments/{segmentID}/constraints"] = constraint.NewCreateConstraint(o.context, o.ConstraintCreateConstraintHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/flags"] = flag.NewCreateFlag(o.context, o.FlagCreateFlagHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/flags/{flagID}/segments"] = segment.NewCreateSegment(o.context, o.SegmentCreateSegmentHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/flags/{flagID}/variants"] = variant.NewCreateVariant(o.context, o.VariantCreateVariantHandler) - if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}"] = constraint.NewDeleteConstraint(o.context, o.ConstraintDeleteConstraintHandler) - if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/flags/{flagID}"] = flag.NewDeleteFlag(o.context, o.FlagDeleteFlagHandler) - if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/flags/{flagID}/segments/{segmentID}"] = segment.NewDeleteSegment(o.context, o.SegmentDeleteSegmentHandler) - if o.handlers["DELETE"] == nil { o.handlers["DELETE"] = make(map[string]http.Handler) } o.handlers["DELETE"]["/flags/{flagID}/variants/{variantID}"] = variant.NewDeleteVariant(o.context, o.VariantDeleteVariantHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}/segments/{segmentID}/constraints"] = constraint.NewFindConstraints(o.context, o.ConstraintFindConstraintsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}/segments/{segmentID}/distributions"] = distribution.NewFindDistributions(o.context, o.DistributionFindDistributionsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags"] = flag.NewFindFlags(o.context, o.FlagFindFlagsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}/segments"] = segment.NewFindSegments(o.context, o.SegmentFindSegmentsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}/variants"] = variant.NewFindVariants(o.context, o.VariantFindVariantsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/export/eval_cache/json"] = export.NewGetExportEvalCacheJSON(o.context, o.ExportGetExportEvalCacheJSONHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/export/sqlite"] = export.NewGetExportSqlite(o.context, o.ExportGetExportSqliteHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}"] = flag.NewGetFlag(o.context, o.FlagGetFlagHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/entity_types"] = flag.NewGetFlagEntityTypes(o.context, o.FlagGetFlagEntityTypesHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/flags/{flagID}/snapshots"] = flag.NewGetFlagSnapshots(o.context, o.FlagGetFlagSnapshotsHandler) - if o.handlers["GET"] == nil { o.handlers["GET"] = make(map[string]http.Handler) } o.handlers["GET"]["/health"] = health.NewGetHealth(o.context, o.HealthGetHealthHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/evaluation"] = evaluation.NewPostEvaluation(o.context, o.EvaluationPostEvaluationHandler) - if o.handlers["POST"] == nil { o.handlers["POST"] = make(map[string]http.Handler) } o.handlers["POST"]["/evaluation/batch"] = evaluation.NewPostEvaluationBatch(o.context, o.EvaluationPostEvaluationBatchHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/segments/{segmentID}/constraints/{constraintID}"] = constraint.NewPutConstraint(o.context, o.ConstraintPutConstraintHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/segments/{segmentID}/distributions"] = distribution.NewPutDistributions(o.context, o.DistributionPutDistributionsHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}"] = flag.NewPutFlag(o.context, o.FlagPutFlagHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/segments/{segmentID}"] = segment.NewPutSegment(o.context, o.SegmentPutSegmentHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/segments/reorder"] = segment.NewPutSegmentsReorder(o.context, o.SegmentPutSegmentsReorderHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/variants/{variantID}"] = variant.NewPutVariant(o.context, o.VariantPutVariantHandler) - if o.handlers["PUT"] == nil { o.handlers["PUT"] = make(map[string]http.Handler) } o.handlers["PUT"]["/flags/{flagID}/enabled"] = flag.NewSetFlagEnabled(o.context, o.FlagSetFlagEnabledHandler) - } // Serve creates a http handler to serve the API over HTTP @@ -670,3 +612,15 @@ func (o *FlagrAPI) RegisterConsumer(mediaType string, consumer runtime.Consumer) func (o *FlagrAPI) RegisterProducer(mediaType string, producer runtime.Producer) { o.customProducers[mediaType] = producer } + +// AddMiddlewareFor adds a http middleware to existing handler +func (o *FlagrAPI) AddMiddlewareFor(method, path string, builder middleware.Builder) { + um := strings.ToUpper(method) + if path == "/" { + path = "" + } + o.Init() + if h, ok := o.handlers[um][path]; ok { + o.handlers[method][path] = builder(h) + } +} diff --git a/swagger_gen/restapi/operations/health/get_health.go b/swagger_gen/restapi/operations/health/get_health.go index 55eb7f1b..6b7ddad9 100644 --- a/swagger_gen/restapi/operations/health/get_health.go +++ b/swagger_gen/restapi/operations/health/get_health.go @@ -8,7 +8,7 @@ package health import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // GetHealthHandlerFunc turns a function with the right signature into a get health handler diff --git a/swagger_gen/restapi/operations/health/get_health_responses.go b/swagger_gen/restapi/operations/health/get_health_responses.go index 1894fbc7..4b5b9ab8 100644 --- a/swagger_gen/restapi/operations/health/get_health_responses.go +++ b/swagger_gen/restapi/operations/health/get_health_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // GetHealthOKCode is the HTTP code returned for type GetHealthOK diff --git a/swagger_gen/restapi/operations/segment/create_segment.go b/swagger_gen/restapi/operations/segment/create_segment.go index c824c3e4..7eb9c16a 100644 --- a/swagger_gen/restapi/operations/segment/create_segment.go +++ b/swagger_gen/restapi/operations/segment/create_segment.go @@ -8,7 +8,7 @@ package segment import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // CreateSegmentHandlerFunc turns a function with the right signature into a create segment handler diff --git a/swagger_gen/restapi/operations/segment/create_segment_parameters.go b/swagger_gen/restapi/operations/segment/create_segment_parameters.go index 0c7a70a5..28ae559f 100644 --- a/swagger_gen/restapi/operations/segment/create_segment_parameters.go +++ b/swagger_gen/restapi/operations/segment/create_segment_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewCreateSegmentParams creates a new CreateSegmentParams object diff --git a/swagger_gen/restapi/operations/segment/create_segment_responses.go b/swagger_gen/restapi/operations/segment/create_segment_responses.go index cb2d4242..5df1dbe7 100644 --- a/swagger_gen/restapi/operations/segment/create_segment_responses.go +++ b/swagger_gen/restapi/operations/segment/create_segment_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // CreateSegmentOKCode is the HTTP code returned for type CreateSegmentOK diff --git a/swagger_gen/restapi/operations/segment/delete_segment.go b/swagger_gen/restapi/operations/segment/delete_segment.go index f8abce86..4ad32784 100644 --- a/swagger_gen/restapi/operations/segment/delete_segment.go +++ b/swagger_gen/restapi/operations/segment/delete_segment.go @@ -8,7 +8,7 @@ package segment import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // DeleteSegmentHandlerFunc turns a function with the right signature into a delete segment handler diff --git a/swagger_gen/restapi/operations/segment/delete_segment_parameters.go b/swagger_gen/restapi/operations/segment/delete_segment_parameters.go index 4aeae197..1bb7cb56 100644 --- a/swagger_gen/restapi/operations/segment/delete_segment_parameters.go +++ b/swagger_gen/restapi/operations/segment/delete_segment_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewDeleteSegmentParams creates a new DeleteSegmentParams object diff --git a/swagger_gen/restapi/operations/segment/delete_segment_responses.go b/swagger_gen/restapi/operations/segment/delete_segment_responses.go index 33459af0..34e1b2d9 100644 --- a/swagger_gen/restapi/operations/segment/delete_segment_responses.go +++ b/swagger_gen/restapi/operations/segment/delete_segment_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // DeleteSegmentOKCode is the HTTP code returned for type DeleteSegmentOK diff --git a/swagger_gen/restapi/operations/segment/find_segments.go b/swagger_gen/restapi/operations/segment/find_segments.go index 6bfbbe68..fa7084db 100644 --- a/swagger_gen/restapi/operations/segment/find_segments.go +++ b/swagger_gen/restapi/operations/segment/find_segments.go @@ -8,7 +8,7 @@ package segment import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // FindSegmentsHandlerFunc turns a function with the right signature into a find segments handler diff --git a/swagger_gen/restapi/operations/segment/find_segments_parameters.go b/swagger_gen/restapi/operations/segment/find_segments_parameters.go index c45ef702..54c8f72f 100644 --- a/swagger_gen/restapi/operations/segment/find_segments_parameters.go +++ b/swagger_gen/restapi/operations/segment/find_segments_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewFindSegmentsParams creates a new FindSegmentsParams object diff --git a/swagger_gen/restapi/operations/segment/find_segments_responses.go b/swagger_gen/restapi/operations/segment/find_segments_responses.go index ea1b0a36..a07078cb 100644 --- a/swagger_gen/restapi/operations/segment/find_segments_responses.go +++ b/swagger_gen/restapi/operations/segment/find_segments_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // FindSegmentsOKCode is the HTTP code returned for type FindSegmentsOK diff --git a/swagger_gen/restapi/operations/segment/put_segment.go b/swagger_gen/restapi/operations/segment/put_segment.go index 2bd21c67..77885bbd 100644 --- a/swagger_gen/restapi/operations/segment/put_segment.go +++ b/swagger_gen/restapi/operations/segment/put_segment.go @@ -8,7 +8,7 @@ package segment import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutSegmentHandlerFunc turns a function with the right signature into a put segment handler diff --git a/swagger_gen/restapi/operations/segment/put_segment_parameters.go b/swagger_gen/restapi/operations/segment/put_segment_parameters.go index e2130445..905ea92a 100644 --- a/swagger_gen/restapi/operations/segment/put_segment_parameters.go +++ b/swagger_gen/restapi/operations/segment/put_segment_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutSegmentParams creates a new PutSegmentParams object diff --git a/swagger_gen/restapi/operations/segment/put_segment_responses.go b/swagger_gen/restapi/operations/segment/put_segment_responses.go index be3ccd4c..d8c1d87e 100644 --- a/swagger_gen/restapi/operations/segment/put_segment_responses.go +++ b/swagger_gen/restapi/operations/segment/put_segment_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutSegmentOKCode is the HTTP code returned for type PutSegmentOK diff --git a/swagger_gen/restapi/operations/segment/put_segments_reorder.go b/swagger_gen/restapi/operations/segment/put_segments_reorder.go index 5203b677..2871c24e 100644 --- a/swagger_gen/restapi/operations/segment/put_segments_reorder.go +++ b/swagger_gen/restapi/operations/segment/put_segments_reorder.go @@ -8,7 +8,7 @@ package segment import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutSegmentsReorderHandlerFunc turns a function with the right signature into a put segments reorder handler diff --git a/swagger_gen/restapi/operations/segment/put_segments_reorder_parameters.go b/swagger_gen/restapi/operations/segment/put_segments_reorder_parameters.go index b8197c9f..e4a560db 100644 --- a/swagger_gen/restapi/operations/segment/put_segments_reorder_parameters.go +++ b/swagger_gen/restapi/operations/segment/put_segments_reorder_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutSegmentsReorderParams creates a new PutSegmentsReorderParams object diff --git a/swagger_gen/restapi/operations/segment/put_segments_reorder_responses.go b/swagger_gen/restapi/operations/segment/put_segments_reorder_responses.go index 21cc2404..e7e0cca2 100644 --- a/swagger_gen/restapi/operations/segment/put_segments_reorder_responses.go +++ b/swagger_gen/restapi/operations/segment/put_segments_reorder_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutSegmentsReorderOKCode is the HTTP code returned for type PutSegmentsReorderOK diff --git a/swagger_gen/restapi/operations/variant/create_variant.go b/swagger_gen/restapi/operations/variant/create_variant.go index 15e32bde..309a73cc 100644 --- a/swagger_gen/restapi/operations/variant/create_variant.go +++ b/swagger_gen/restapi/operations/variant/create_variant.go @@ -8,7 +8,7 @@ package variant import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // CreateVariantHandlerFunc turns a function with the right signature into a create variant handler diff --git a/swagger_gen/restapi/operations/variant/create_variant_parameters.go b/swagger_gen/restapi/operations/variant/create_variant_parameters.go index ee0ccbd0..49cc6d38 100644 --- a/swagger_gen/restapi/operations/variant/create_variant_parameters.go +++ b/swagger_gen/restapi/operations/variant/create_variant_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewCreateVariantParams creates a new CreateVariantParams object diff --git a/swagger_gen/restapi/operations/variant/create_variant_responses.go b/swagger_gen/restapi/operations/variant/create_variant_responses.go index 98efe474..2d88887b 100644 --- a/swagger_gen/restapi/operations/variant/create_variant_responses.go +++ b/swagger_gen/restapi/operations/variant/create_variant_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // CreateVariantOKCode is the HTTP code returned for type CreateVariantOK diff --git a/swagger_gen/restapi/operations/variant/delete_variant.go b/swagger_gen/restapi/operations/variant/delete_variant.go index 7aea8fe2..d7fd917b 100644 --- a/swagger_gen/restapi/operations/variant/delete_variant.go +++ b/swagger_gen/restapi/operations/variant/delete_variant.go @@ -8,7 +8,7 @@ package variant import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // DeleteVariantHandlerFunc turns a function with the right signature into a delete variant handler diff --git a/swagger_gen/restapi/operations/variant/delete_variant_parameters.go b/swagger_gen/restapi/operations/variant/delete_variant_parameters.go index d8c3293e..b8705f02 100644 --- a/swagger_gen/restapi/operations/variant/delete_variant_parameters.go +++ b/swagger_gen/restapi/operations/variant/delete_variant_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewDeleteVariantParams creates a new DeleteVariantParams object diff --git a/swagger_gen/restapi/operations/variant/delete_variant_responses.go b/swagger_gen/restapi/operations/variant/delete_variant_responses.go index 0c0d3aac..d2acc971 100644 --- a/swagger_gen/restapi/operations/variant/delete_variant_responses.go +++ b/swagger_gen/restapi/operations/variant/delete_variant_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // DeleteVariantOKCode is the HTTP code returned for type DeleteVariantOK diff --git a/swagger_gen/restapi/operations/variant/find_variants.go b/swagger_gen/restapi/operations/variant/find_variants.go index 00a85ccb..3755f09d 100644 --- a/swagger_gen/restapi/operations/variant/find_variants.go +++ b/swagger_gen/restapi/operations/variant/find_variants.go @@ -8,7 +8,7 @@ package variant import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // FindVariantsHandlerFunc turns a function with the right signature into a find variants handler diff --git a/swagger_gen/restapi/operations/variant/find_variants_parameters.go b/swagger_gen/restapi/operations/variant/find_variants_parameters.go index a2a8dff8..17dc9871 100644 --- a/swagger_gen/restapi/operations/variant/find_variants_parameters.go +++ b/swagger_gen/restapi/operations/variant/find_variants_parameters.go @@ -10,10 +10,9 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - - strfmt "github.com/go-openapi/strfmt" ) // NewFindVariantsParams creates a new FindVariantsParams object diff --git a/swagger_gen/restapi/operations/variant/find_variants_responses.go b/swagger_gen/restapi/operations/variant/find_variants_responses.go index ed5541ce..b518b919 100644 --- a/swagger_gen/restapi/operations/variant/find_variants_responses.go +++ b/swagger_gen/restapi/operations/variant/find_variants_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // FindVariantsOKCode is the HTTP code returned for type FindVariantsOK diff --git a/swagger_gen/restapi/operations/variant/put_variant.go b/swagger_gen/restapi/operations/variant/put_variant.go index 3386c633..ce1a429e 100644 --- a/swagger_gen/restapi/operations/variant/put_variant.go +++ b/swagger_gen/restapi/operations/variant/put_variant.go @@ -8,7 +8,7 @@ package variant import ( "net/http" - middleware "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/runtime/middleware" ) // PutVariantHandlerFunc turns a function with the right signature into a put variant handler diff --git a/swagger_gen/restapi/operations/variant/put_variant_parameters.go b/swagger_gen/restapi/operations/variant/put_variant_parameters.go index 79644d88..d7aef064 100644 --- a/swagger_gen/restapi/operations/variant/put_variant_parameters.go +++ b/swagger_gen/restapi/operations/variant/put_variant_parameters.go @@ -12,12 +12,11 @@ import ( "github.com/go-openapi/errors" "github.com/go-openapi/runtime" "github.com/go-openapi/runtime/middleware" + "github.com/go-openapi/strfmt" "github.com/go-openapi/swag" "github.com/go-openapi/validate" - strfmt "github.com/go-openapi/strfmt" - - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // NewPutVariantParams creates a new PutVariantParams object diff --git a/swagger_gen/restapi/operations/variant/put_variant_responses.go b/swagger_gen/restapi/operations/variant/put_variant_responses.go index a1a19d61..0047ab57 100644 --- a/swagger_gen/restapi/operations/variant/put_variant_responses.go +++ b/swagger_gen/restapi/operations/variant/put_variant_responses.go @@ -10,7 +10,7 @@ import ( "github.com/go-openapi/runtime" - models "github.com/checkr/flagr/swagger_gen/models" + "github.com/checkr/flagr/swagger_gen/models" ) // PutVariantOKCode is the HTTP code returned for type PutVariantOK diff --git a/swagger_gen/restapi/server.go b/swagger_gen/restapi/server.go index 4015cdd1..13429129 100644 --- a/swagger_gen/restapi/server.go +++ b/swagger_gen/restapi/server.go @@ -173,8 +173,6 @@ func (s *Server) Serve() (err error) { go handleInterrupt(once, s) servers := []*http.Server{} - wg.Add(1) - go s.handleShutdown(wg, &servers) if s.hasScheme(schemeUnix) { domainSocket := new(http.Server) @@ -324,6 +322,9 @@ func (s *Server) Serve() (err error) { }(tls.NewListener(s.httpsServerL, httpsServer.TLSConfig)) } + wg.Add(1) + go s.handleShutdown(wg, &servers) + wg.Wait() return nil } @@ -419,6 +420,9 @@ func (s *Server) handleShutdown(wg *sync.WaitGroup, serversPtr *[]*http.Server) ctx, cancel := context.WithTimeout(context.TODO(), s.GracefulTimeout) defer cancel() + // first execute the pre-shutdown hook + s.api.PreServerShutdown() + shutdownChan := make(chan bool) for i := range servers { server := servers[i] @@ -488,7 +492,7 @@ func (s *Server) TLSListener() (net.Listener, error) { func handleInterrupt(once *sync.Once, s *Server) { once.Do(func() { - for _ = range s.interrupt { + for range s.interrupt { if s.interrupted { s.Logf("Server already shutting down") continue From 849124c9156a455088f3b25513ba8e376a6ec6e9 Mon Sep 17 00:00:00 2001 From: zhuojie Date: Thu, 19 Mar 2020 14:40:18 -0700 Subject: [PATCH 2/2] Add changelog --- CHANGELOG.md | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 013c08dc..408086ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,21 @@ # Changelog +## [1.1.7](https://github.com/checkr/flagr/tree/1.1.7) (2020-03-19) + +[Full Changelog](https://github.com/checkr/flagr/compare/1.1.6...HEAD) + +**Closed issues:** + +- When flagr encounters database errors during the `GetFlag` func it returns 404 [\#317](https://github.com/checkr/flagr/issues/317) + +**Merged pull requests:** + +- Add 404 get flag test [\#337](https://github.com/checkr/flagr/pull/337) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add publish dockerhub action [\#336](https://github.com/checkr/flagr/pull/336) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Update UI version [\#335](https://github.com/checkr/flagr/pull/335) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add changelog [\#334](https://github.com/checkr/flagr/pull/334) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add better error checking around 404s and actual database errors [\#318](https://github.com/checkr/flagr/pull/318) ([Cull-Methi](https://github.com/Cull-Methi)) + ## [1.1.6](https://github.com/checkr/flagr/tree/1.1.6) (2020-03-17) [Full Changelog](https://github.com/checkr/flagr/compare/1.1.5...1.1.6) @@ -80,8 +96,6 @@ - Use lower case and computed for search terms [\#271](https://github.com/checkr/flagr/pull/271) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Height fix for json-editor in variant attachment [\#269](https://github.com/checkr/flagr/pull/269) ([yosyad](https://github.com/yosyad)) - Add search bar for filtering flags in home page [\#268](https://github.com/checkr/flagr/pull/268) ([yosyad](https://github.com/yosyad)) -- Fix assetsDir [\#266](https://github.com/checkr/flagr/pull/266) ([zhouzhuojie](https://github.com/zhouzhuojie)) -- Remove yarn and upgrade to vue-cli 3 [\#265](https://github.com/checkr/flagr/pull/265) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.1.3](https://github.com/checkr/flagr/tree/1.1.3) (2019-05-30) @@ -94,6 +108,8 @@ **Merged pull requests:** +- Fix assetsDir [\#266](https://github.com/checkr/flagr/pull/266) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Remove yarn and upgrade to vue-cli 3 [\#265](https://github.com/checkr/flagr/pull/265) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add support for arbitrary JSON in attachments [\#259](https://github.com/checkr/flagr/pull/259) ([saary](https://github.com/saary)) - Changed input text to json-editor in flag variant form [\#258](https://github.com/checkr/flagr/pull/258) ([yosyad](https://github.com/yosyad)) @@ -119,7 +135,6 @@ - Pin flagr-ci docker version tag [\#250](https://github.com/checkr/flagr/pull/250) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix lint and make vendor [\#249](https://github.com/checkr/flagr/pull/249) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add go module support [\#248](https://github.com/checkr/flagr/pull/248) ([zhouzhuojie](https://github.com/zhouzhuojie)) -- ensure header color css applies only within el-card\_\_header [\#246](https://github.com/checkr/flagr/pull/246) ([crberube](https://github.com/crberube)) ## [1.1.1](https://github.com/checkr/flagr/tree/1.1.1) (2019-04-16) @@ -136,9 +151,11 @@ **Merged pull requests:** - Extend DBDRIVER to load from json\_file or json\_http and add EvalOnlyMode [\#247](https://github.com/checkr/flagr/pull/247) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- ensure header color css applies only within el-card\_\_header [\#246](https://github.com/checkr/flagr/pull/246) ([crberube](https://github.com/crberube)) - Call data recorder at the startup time [\#245](https://github.com/checkr/flagr/pull/245) ([zhouzhuojie](https://github.com/zhouzhuojie)) - add note support to flags [\#243](https://github.com/checkr/flagr/pull/243) ([crberube](https://github.com/crberube)) - Remove entity\_type statsd tag [\#242](https://github.com/checkr/flagr/pull/242) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Remove required fields from evalResult swagger model [\#239](https://github.com/checkr/flagr/pull/239) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Use web prefix for main API [\#234](https://github.com/checkr/flagr/pull/234) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.1.0](https://github.com/checkr/flagr/tree/1.1.0) (2019-03-19) @@ -149,10 +166,6 @@ - Consolidate the evalResult for kafka, kinesis and pubsub logging [\#203](https://github.com/checkr/flagr/issues/203) -**Merged pull requests:** - -- Remove required fields from evalResult swagger model [\#239](https://github.com/checkr/flagr/pull/239) ([zhouzhuojie](https://github.com/zhouzhuojie)) - ## [1.0.15](https://github.com/checkr/flagr/tree/1.0.15) (2019-03-11) [Full Changelog](https://github.com/checkr/flagr/compare/1.0.14...1.0.15) @@ -168,8 +181,8 @@ - Add EvalDebugEnabled env variable [\#235](https://github.com/checkr/flagr/pull/235) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Refactor data recorder [\#233](https://github.com/checkr/flagr/pull/233) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add release badge [\#227](https://github.com/checkr/flagr/pull/227) ([zhouzhuojie](https://github.com/zhouzhuojie)) -- Use English as default locale for flagr instead of Chinese [\#226](https://github.com/checkr/flagr/pull/226) ([lawrenceong](https://github.com/lawrenceong)) - Bump version [\#224](https://github.com/checkr/flagr/pull/224) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Bump conditions [\#219](https://github.com/checkr/flagr/pull/219) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.0.14](https://github.com/checkr/flagr/tree/1.0.14) (2019-02-22) @@ -186,14 +199,13 @@ **Merged pull requests:** +- Use English as default locale for flagr instead of Chinese [\#226](https://github.com/checkr/flagr/pull/226) ([lawrenceong](https://github.com/lawrenceong)) - Use relative assetsPublicPath [\#223](https://github.com/checkr/flagr/pull/223) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Adds Prometheus export \(requests and variant eval\) [\#221](https://github.com/checkr/flagr/pull/221) ([jasongwartz](https://github.com/jasongwartz)) -- Bump conditions [\#219](https://github.com/checkr/flagr/pull/219) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Revert "Bump vendors" [\#218](https://github.com/checkr/flagr/pull/218) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Bump vendors [\#217](https://github.com/checkr/flagr/pull/217) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix empty response when flag was deleted [\#213](https://github.com/checkr/flagr/pull/213) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Added Google Cloud Pubsub support for data records [\#209](https://github.com/checkr/flagr/pull/209) ([vic3lord](https://github.com/vic3lord)) -- Add datadog apm support [\#205](https://github.com/checkr/flagr/pull/205) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.0.13](https://github.com/checkr/flagr/tree/1.0.13) (2019-01-30) @@ -212,6 +224,7 @@ - Add retry for DB connection [\#208](https://github.com/checkr/flagr/pull/208) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix golint [\#206](https://github.com/checkr/flagr/pull/206) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add datadog apm support [\#205](https://github.com/checkr/flagr/pull/205) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Replace '+' icon with 'Add Constraint' to make usage clearer [\#202](https://github.com/checkr/flagr/pull/202) ([erdey](https://github.com/erdey)) - Add preload param in get /flags [\#200](https://github.com/checkr/flagr/pull/200) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Update README.md [\#198](https://github.com/checkr/flagr/pull/198) ([zhouzhuojie](https://github.com/zhouzhuojie)) @@ -269,12 +282,12 @@ - Improve homepage UI [\#164](https://github.com/checkr/flagr/pull/164) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix 401 jwt middleware handling [\#163](https://github.com/checkr/flagr/pull/163) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Improve UI [\#162](https://github.com/checkr/flagr/pull/162) ([zhouzhuojie](https://github.com/zhouzhuojie)) -- Change random key generation and db logging for migration [\#160](https://github.com/checkr/flagr/pull/160) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add flagr key [\#159](https://github.com/checkr/flagr/pull/159) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Bump vendor [\#158](https://github.com/checkr/flagr/pull/158) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add helper script for getting remote sqlite [\#157](https://github.com/checkr/flagr/pull/157) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add curl in dockerfile [\#156](https://github.com/checkr/flagr/pull/156) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Update docs and add operation id [\#155](https://github.com/checkr/flagr/pull/155) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add export to sqlite feature [\#154](https://github.com/checkr/flagr/pull/154) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.0.9](https://github.com/checkr/flagr/tree/1.0.9) (2018-08-24) @@ -286,7 +299,7 @@ **Merged pull requests:** -- Add export to sqlite feature [\#154](https://github.com/checkr/flagr/pull/154) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Change random key generation and db logging for migration [\#160](https://github.com/checkr/flagr/pull/160) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Bump vendors [\#153](https://github.com/checkr/flagr/pull/153) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix typo on constraints error alert [\#152](https://github.com/checkr/flagr/pull/152) ([chrisivens](https://github.com/chrisivens)) - Add Kinesis support [\#151](https://github.com/checkr/flagr/pull/151) ([marceloboeira](https://github.com/marceloboeira)) @@ -295,6 +308,8 @@ - Add coverage for kafka data recorder [\#145](https://github.com/checkr/flagr/pull/145) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add test coverage for middleware [\#144](https://github.com/checkr/flagr/pull/144) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Bump UI packages [\#143](https://github.com/checkr/flagr/pull/143) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Fix docs [\#141](https://github.com/checkr/flagr/pull/141) ([zhouzhuojie](https://github.com/zhouzhuojie)) +- Add tests for find flags parameters [\#138](https://github.com/checkr/flagr/pull/138) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.0.8](https://github.com/checkr/flagr/tree/1.0.8) (2018-07-06) @@ -310,9 +325,7 @@ **Merged pull requests:** -- Fix docs [\#141](https://github.com/checkr/flagr/pull/141) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Add health handler [\#140](https://github.com/checkr/flagr/pull/140) ([zhouzhuojie](https://github.com/zhouzhuojie)) -- Add tests for find flags parameters [\#138](https://github.com/checkr/flagr/pull/138) ([zhouzhuojie](https://github.com/zhouzhuojie)) - Fix InsecureVerifySSL config [\#137](https://github.com/checkr/flagr/pull/137) ([zhouzhuojie](https://github.com/zhouzhuojie)) ## [1.0.7](https://github.com/checkr/flagr/tree/1.0.7) (2018-06-26)