mirror of
https://github.com/niusmallnan/steve.git
synced 2025-08-28 17:51:57 +00:00
Set namespace to request namespace on create if namespace is empty
This commit is contained in:
parent
1d84c1fc9f
commit
8f5ca57628
@ -372,6 +372,10 @@ func (s *Store) Create(apiOp *types.APIRequest, schema *types.APISchema, params
|
|||||||
if name == "" && input.String("metadata", "generateName") == "" {
|
if name == "" && input.String("metadata", "generateName") == "" {
|
||||||
input.SetNested(schema.ID[0:1]+"-", "metadata", "generatedName")
|
input.SetNested(schema.ID[0:1]+"-", "metadata", "generatedName")
|
||||||
}
|
}
|
||||||
|
if ns == "" && apiOp.Namespace != "" {
|
||||||
|
ns = apiOp.Namespace
|
||||||
|
input.SetNested(ns, "metadata", "namespace")
|
||||||
|
}
|
||||||
|
|
||||||
gvk := attributes.GVK(schema)
|
gvk := attributes.GVK(schema)
|
||||||
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
|
input["apiVersion"], input["kind"] = gvk.ToAPIVersionAndKind()
|
||||||
|
Loading…
Reference in New Issue
Block a user