From 852a656893bdf9e7803d0dd628b41c3d53f84b4d Mon Sep 17 00:00:00 2001 From: Felipe Gehrke Date: Thu, 5 Sep 2024 14:25:02 -0300 Subject: [PATCH] Update pkg/stores/proxy/proxy_store.go Co-authored-by: Tom Lebreux --- pkg/stores/proxy/proxy_store.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/pkg/stores/proxy/proxy_store.go b/pkg/stores/proxy/proxy_store.go index 9f254307..9bb094f3 100644 --- a/pkg/stores/proxy/proxy_store.go +++ b/pkg/stores/proxy/proxy_store.go @@ -434,18 +434,15 @@ func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, params input.SetNested(schema.ID[0:1]+"-", "metadata", "generateName") } - if attributes.Namespaced(schema) { - if namespace == "" { - if apiOp.Namespace == "" { - return nil, nil, validation.ErrorCode{ - Status: http.StatusUnprocessableEntity, - Code: errNamespaceRequired, - } + if attributes.Namespaced(schema) && namespace == "" { + if apiOp.Namespace == "" { + return nil, nil, validation.ErrorCode{ + Status: http.StatusUnprocessableEntity, + Code: errNamespaceRequired, } - - namespace = apiOp.Namespace } + namespace = apiOp.Namespace input.SetNested(namespace, "metadata", "namespace") }