From f9314df5f8265d27c273805c61df1326a016b0d3 Mon Sep 17 00:00:00 2001 From: Jakub Bednar Date: Thu, 2 Jul 2020 08:49:42 +0200 Subject: [PATCH] fix(swagger): PostBucketRequest.orgID is required Signed-off-by: Jakub Bednar --- http/bucket_service_test.go | 28 ++++++++++++++++++++++++++++ http/swagger.yml | 2 +- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/http/bucket_service_test.go b/http/bucket_service_test.go index a7aa441538..50c2d50025 100644 --- a/http/bucket_service_test.go +++ b/http/bucket_service_test.go @@ -457,6 +457,34 @@ func TestService_handlePostBucket(t *testing.T) { statusCode: http.StatusUnprocessableEntity, }, }, + { + name: "create a new bucket without orgId", + fields: fields{ + BucketService: &mock.BucketService{ + CreateBucketFn: func(ctx context.Context, c *influxdb.Bucket) error { + c.ID = platformtesting.MustIDBase16("020f755c3c082000") + return nil + }, + }, + OrganizationService: &mock.OrganizationService{ + FindOrganizationF: func(ctx context.Context, f influxdb.OrganizationFilter) (*influxdb.Organization, error) { + return &influxdb.Organization{ID: platformtesting.MustIDBase16("6f626f7274697320")}, nil + }, + }, + }, + args: args{ + bucket: &influxdb.Bucket{ + Name: "hello", + }, + }, + wants: wants{ + statusCode: http.StatusBadRequest, + body: `{ + "code": "invalid", + "message": "organization id must be provided" +}`, + }, + }, } for _, tt := range tests { diff --git a/http/swagger.yml b/http/swagger.yml index f848a806c2..d66eb08278 100644 --- a/http/swagger.yml +++ b/http/swagger.yml @@ -7430,7 +7430,7 @@ components: type: string retentionRules: $ref: "#/components/schemas/RetentionRules" - required: [name, retentionRules] + required: [orgID, name, retentionRules] Bucket: properties: links: