1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-18 08:14:56 +00:00

Stop ignoring id fields for sub-schemas

When generating types, any field with name "id" was being skipped. The intention
here was to skip the "id" field of the embedded types.Resource struct. A type
will have an embedded types.Resource struct when the hasGet function returns
true. Therefore, this hasGet function is also used to skip the id fields as
desired.
This commit is contained in:
Donnie Adams
2021-11-29 16:17:47 -07:00
parent 33e9117898
commit eb95d28e82

View File

@@ -106,7 +106,7 @@ func getTypeString(nullable bool, typeName string, pointer bool, schema *types.S
func getTypeMap(schema *types.Schema, schemas *types.Schemas) map[string]fieldInfo {
result := map[string]fieldInfo{}
for name, field := range schema.ResourceFields {
if strings.EqualFold(name, "id") {
if strings.EqualFold(name, "id") && hasGet(schema) {
continue
}
result[field.CodeName] = fieldInfo{