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:
@@ -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{
|
||||
|
Reference in New Issue
Block a user