mirror of
https://github.com/rancher/norman.git
synced 2025-08-30 21:52:02 +00:00
Add dynamic field to field struct
This change adds a dynamic field indicator to the field struct. This is so we can remove the dynamic fields from an existing schema before merging the dynamic schema and actual schema to prevent removed dynamic fields form being incorrectly left behind on the schema. Issue: https://github.com/rancher/rancher/issues/12698
This commit is contained in:
parent
3a7e3090fb
commit
e2fa956b64
@ -170,7 +170,12 @@ func (s *Schemas) embed(schema *Schema) {
|
||||
newSchema.ResourceFields = map[string]Field{}
|
||||
|
||||
for k, v := range target.ResourceFields {
|
||||
newSchema.ResourceFields[k] = v
|
||||
// We remove the dynamic fields off the existing schema in case
|
||||
// they've been removed from the dynamic schema so they won't
|
||||
// be accidentally left over
|
||||
if !v.DynamicField {
|
||||
newSchema.ResourceFields[k] = v
|
||||
}
|
||||
}
|
||||
for k, v := range schema.ResourceFields {
|
||||
newSchema.ResourceFields[k] = v
|
||||
|
@ -136,6 +136,7 @@ type Field struct {
|
||||
InvalidChars string `json:"invalidChars,omitempty"`
|
||||
Description string `json:"description,omitempty"`
|
||||
CodeName string `json:"-"`
|
||||
DynamicField bool `json:"dynamicField,omitempty"`
|
||||
}
|
||||
|
||||
type Action struct {
|
||||
|
Loading…
Reference in New Issue
Block a user