Skip to content

Commit feb7d2e

Browse files
author
Nicholas Thomson
committed
Rename config to ListOf and MapOf
1 parent 825cb75 commit feb7d2e

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

pkg/generate/config/field.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,13 +139,13 @@ type PrintFieldConfig struct {
139139
// CustomField instructs the code generator to create a new field that does
140140
// not exist in the SDK.
141141
type CustomFieldConfig struct {
142-
// MemberShape provides the name of the SDK shape which will become the
142+
// ListOf provides the name of the SDK shape which will become the
143143
// member of a custom slice field.
144-
MemberShape string `json:"member_shape,omitempty"`
145-
// ValueShape provides the name of the SDK shape which will become the value
144+
ListOf string `json:"list_of,omitempty"`
145+
// MapOf provides the name of the SDK shape which will become the value
146146
// shape for a custom map field. All maps will have `string` as their key
147147
// type.
148-
ValueShape string `json:"value_shape,omitempty"`
148+
MapOf string `json:"map_of,omitempty"`
149149
}
150150

151151
// LateInitializeConfig contains instructions for how to handle the

pkg/model/model.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ func (m *Model) GetCRDs() ([]*CRD, error) {
158158
}
159159
} else if fieldConfig.CustomField != nil {
160160
customField := fieldConfig.CustomField
161-
if customField.MemberShape != "" {
162-
memberShapeRef, found = m.SDKAPI.GetCustomListRef(customField.MemberShape)
161+
if customField.ListOf != "" {
162+
memberShapeRef, found = m.SDKAPI.GetCustomListRef(customField.ListOf)
163163
} else {
164-
memberShapeRef, found = m.SDKAPI.GetCustomMapRef(customField.ValueShape)
164+
memberShapeRef, found = m.SDKAPI.GetCustomMapRef(customField.MapOf)
165165
}
166166
if !found {
167167
// This is a compile-time failure, just bomb out...
@@ -250,10 +250,10 @@ func (m *Model) GetCRDs() ([]*CRD, error) {
250250
}
251251
} else if fieldConfig.CustomField != nil {
252252
customField := fieldConfig.CustomField
253-
if customField.MemberShape != "" {
254-
memberShapeRef, found = m.SDKAPI.GetCustomListRef(customField.MemberShape)
253+
if customField.ListOf != "" {
254+
memberShapeRef, found = m.SDKAPI.GetCustomListRef(customField.ListOf)
255255
} else {
256-
memberShapeRef, found = m.SDKAPI.GetCustomMapRef(customField.ValueShape)
256+
memberShapeRef, found = m.SDKAPI.GetCustomMapRef(customField.MapOf)
257257
}
258258
if !found {
259259
// This is a compile-time failure, just bomb out...

pkg/sdk/custom_shapes.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ func (h *Helper) getCustomListFieldMembers() []string {
7777

7878
for _, resource := range h.cfg.Resources {
7979
for _, field := range resource.Fields {
80-
if field.CustomField != nil && field.CustomField.MemberShape != "" {
81-
members = append(members, field.CustomField.MemberShape)
80+
if field.CustomField != nil && field.CustomField.ListOf != "" {
81+
members = append(members, field.CustomField.ListOf)
8282
}
8383
}
8484
}
@@ -93,8 +93,8 @@ func (h *Helper) getCustomMapFieldMembers() []string {
9393

9494
for _, resource := range h.cfg.Resources {
9595
for _, field := range resource.Fields {
96-
if field.CustomField != nil && field.CustomField.ValueShape != "" {
97-
members = append(members, field.CustomField.ValueShape)
96+
if field.CustomField != nil && field.CustomField.MapOf != "" {
97+
members = append(members, field.CustomField.MapOf)
9898
}
9999
}
100100
}

0 commit comments

Comments
 (0)