1
0
mirror of https://github.com/rancher/types.git synced 2025-07-15 22:15:49 +00:00

Make projectID on namespace required

This commit is contained in:
Darren Shepherd 2018-02-09 17:04:29 -07:00
parent 5a61b881a7
commit 85c8733440
2 changed files with 3 additions and 1 deletions

View File

@ -68,7 +68,7 @@ func NamespaceTypes(version *types.APIVersion, schemas *types.Schemas) *types.Sc
).
MustImport(version, v1.Namespace{}, struct {
Description string `json:"description"`
ProjectID string `norman:"type=reference[/v3/schemas/project]"`
ProjectID string `norman:"type=reference[/v3/schemas/project],required"`
Templates map[string]string `json:"templates"`
Answers map[string]interface{} `json:"answers"`
Prune bool `json:"prune"`

View File

@ -246,6 +246,7 @@ func addSecretSubtypes(schemas *types.Schemas, objs ...interface{}) *types.Schem
for _, name := range namespaced {
baseSchema := schemas.Schema(&Version, name)
// Make non-namespaced have namespaceId not required
newFields := map[string]types.Field{}
for name, field := range baseSchema.ResourceFields {
if name == "namespaceId" {
@ -259,6 +260,7 @@ func addSecretSubtypes(schemas *types.Schemas, objs ...interface{}) *types.Schem
schema.PluralName = "namespaced" + convert.Capitalize(schema.PluralName)
schema.CodeName = "Namespaced" + schema.CodeName
schema.CodeNamePlural = "Namespaced" + schema.CodeNamePlural
schema.BaseType = "namespacedSecret"
schemas.AddSchema(schema)
baseSchema.ResourceFields = newFields