From 76555c841928219ae203ab448124f65f5dd1f0ad Mon Sep 17 00:00:00 2001 From: Fabian Fischer Date: Wed, 3 Aug 2022 10:52:17 +0200 Subject: [PATCH] Remove default GitRepo Type from specification Our OpenAPI validation library added support for default values. This includes a feature/bug that fails the validation if defaults are set for `merge-patch+json` requests. We currently define a GitRepo type default of `auto` . This is defined across all requests and responses. However this is arguably wrong for patches. When patching a resource we generally don't want to set default as this will lead to unexpected results (i.e. reverting to the default if we do not explicitly set it to the current value in the patch) For this reason (and to fix the validation error) we remove the GitRepo type default from the specification. --- openapi.yaml | 1 - pkg/api/openapi.go | 86 +++++++++++++++++++------------------- pkg/service/tenant_test.go | 2 + 3 files changed, 45 insertions(+), 44 deletions(-) diff --git a/openapi.yaml b/openapi.yaml index a983734..4c6269f 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -212,7 +212,6 @@ components: type: string description: Specifies if a repo should be managed by the git controller. A value of 'unmanaged' means it's not manged by the controller example: auto - default: auto deployKey: type: string description: SSH public key / deploy key for clusterconfiguration catalog Git repository. This property is managed by Steward. diff --git a/pkg/api/openapi.go b/pkg/api/openapi.go index fa0adef..7d849ec 100644 --- a/pkg/api/openapi.go +++ b/pkg/api/openapi.go @@ -655,49 +655,49 @@ var swaggerSpec = []string{ "BzNZffsbxm8Z0mdkYrLa/UgQ2ru8NDZJCQMUcSnJkILhi3kcUdCMkq8KlxoTRfGw4fMQrXW/7ijeP3p3", "Obj+Ft9N1fb++20VHHb6x1FrT7EmO4WjozdbF6f358HoC8sBBz+QuC4neLPOiFTR5ta2QfJm8/L676OT", "yfFfJ/zToKeGIb0Pjrqzk8Eng6/4997e3tv++2/3f8Lljri4v+jcfCTq8BrOO2cf+3hzp3/27c/W6PJm", - "oq7bR7c7d9fHl39dfhIXOx/op4/i9PivvejD9ruP18PrwcEgOLjhfPL2fjx88+nf1cKwD7QgXHnl6TzO", - "m6+J+hH4ZERA6jCIjZYlLqaY0SXy0rWN4JSCaKCuq3n4CL2ImTv8AoWA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aLLl608i2zWX+0noGuFKd7n", - "krkTqkBkCLSvt8SToFiwwD3n28mg7FtspViYlHn5udi8bX/9RZETBeG6reXcxAILgWdVquCOImqGguMG", - "ehNGaobMeV0bMu4YkWN64+eVJVWPc1CxYBJhgzkv3JyWpOn7Q82LuKzQjH0dSSHXW8v0wcX13oGO5ZWF", - "V6HYuvJ/vrS6spXVF6ZLKw3xlovgB4urnkL+BPwbmTSmnf7BHZFKoiGMuACXObCxOWHDQw1xNQFxSySg", - "ESZUWmDJjaU5euXkfJWUqjqDIUqiK3sbFwr7EfjJlfSJqyHnSiqBI9O6vrKFv5mqFW3NymE/reZ0zgZS", - "7fFg9mgeLdXqCi1O1IDBLSpSkY2rH0qm13oW2pxmGtGBzqO9ziP6+cVz7xQxZi9M17hAwVaFMSVjE6rL", - "/JlTvUcwdise6eSTm72V7DwfDprf062IB0ssBVWV3JrnstBNmAu45kSmF3OhoOpK2ZFmxcJHhRvvLOan", - "Jdzxvf2MkjeIiS3EhyQIgD2CMKvYXeWwKyN56vbtgC0GOd8HKkruENTTim3jOV3AiMfMqUFn2QQ/LXmk", - "a9MGiAToFkttyAbIo4bghbKojMNY+ZOK6WwU4OVGaE88ujTXiTMhiDHUDeX/+imh5rsaZfHamxWll+sE", - "KG6c78T2w1+ev91Hr9s726/WCFDPqp2xucZvcFMW8aM6qSp1rNTmWC3WZZ4E7WVqfRar36LTjyZ+p73p", - "ZRH+gQzqdyno78zd/ktMY4F2V+dkAfcXl+c9pkDYfUVTVwXcj0NgtjmJhljadZH+LR6PQaCLcql+oMGv", - "VC4Fd6o5USEtcni+xC4xM0OMsJSgU9oljYvSDRa1LSaAqZrcL2SLBmTP2MqudOsjB2C9i0cUkzndytoS", - "/Kaij1jehKVUF8MjwuDR+z0Vt63kWtWq1GIW5nvs6M/+6UlhydZV2wwggABlntUMniZ4qg8lO2FxZCpa", - "ETP9ra2ReyotkQWPxxMDMest7Rf2dUwgHxEW5GpvFOqcIqnH3QKZayoQoAG60hlco1hF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CR", + "oT+KQacO5Zd54Qz42cdoCd51p2ju/BMP0VJlKDmRXERrfk9+qrvmAG3Rwoo5kNrAj3U5yz9AXm96Nkj2", + "9Z55eJbH+3Szs8Xy+8HJ2QKRHYJ6SnltPIPzc4JYNTRzMfH3zsyWiXPlxGyBCO2BR5bi047LyjvAC+cN", + "ebH904ZlK3Xy2UdlBbxPNClbqsNrz8kWKPNZrH6DJj+W2CtmZGtnY79HLf8vZYH/HQZYbUXl9K7Y8Siu", + "gX/+qm3D/pSyqjd6zH1MUQBToDwKwWCwi9VNW/MvXNzOrfOeCR7EvsmNbNOjuJpd+i38+pB7TMHY7dYv", + "AF0nTP0s+AOYLgQbwHQe7NeU+/Pwc1vshYK+uAZcpqv4XW7htfg//an4Mun8F9vs6YfFx4s/zzqEioTg", + "RrOuWehAZb3CMhhdW7vOWXre/f3w9eF/AwAA//8Ll0fTJkkAAA==", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/pkg/service/tenant_test.go b/pkg/service/tenant_test.go index 0f74fdc..c491d66 100644 --- a/pkg/service/tenant_test.go +++ b/pkg/service/tenant_test.go @@ -66,6 +66,8 @@ func TestCreateTenant(t *testing.T) { assert.Contains(t, tenant.Id, api.TenantIDPrefix) assert.Equal(t, newTenant.DisplayName, tenant.DisplayName) assert.Equal(t, newTenant.GitRepo.Url, tenant.GitRepo.Url) + assert.NotNil(t, tenant.GitRepo.Type) + assert.Equal(t, "auto", *tenant.GitRepo.Type) assert.Contains(t, *tenant.Annotations, "new") assert.Len(t, *tenant.Annotations, 1)