Skip to content

Commit 02cb3c2

Browse files
committed
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.
1 parent c4cd9ca commit 02cb3c2

3 files changed

Lines changed: 45 additions & 44 deletions

File tree

openapi.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ components:
212212
type: string
213213
description: Specifies if a repo should be managed by the git controller. A value of 'unmanaged' means it's not manged by the controller
214214
example: auto
215-
default: auto
216215
deployKey:
217216
type: string
218217
description: SSH public key / deploy key for clusterconfiguration catalog Git repository. This property is managed by Steward.

pkg/api/openapi.go

Lines changed: 43 additions & 43 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/service/tenant_test.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ func TestCreateTenant(t *testing.T) {
6666
assert.Contains(t, tenant.Id, api.TenantIDPrefix)
6767
assert.Equal(t, newTenant.DisplayName, tenant.DisplayName)
6868
assert.Equal(t, newTenant.GitRepo.Url, tenant.GitRepo.Url)
69+
assert.NotNil(t, tenant.GitRepo.Type)
70+
assert.Equal(t, "auto", *tenant.GitRepo.Type)
6971
assert.Contains(t, *tenant.Annotations, "new")
7072
assert.Len(t, *tenant.Annotations, 1)
7173

0 commit comments

Comments
 (0)