1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-17 15:49:53 +00:00

Don't generate the ID field

This commit is contained in:
Darren Shepherd
2018-01-15 22:08:26 -07:00
parent 7d895bb074
commit 9ce12b1644
2 changed files with 7 additions and 0 deletions

View File

@@ -101,6 +101,9 @@ func getTypeString(nullable bool, typeName string, schema *types.Schema, schemas
func getTypeMap(schema *types.Schema, schemas *types.Schemas) map[string]fieldInfo { func getTypeMap(schema *types.Schema, schemas *types.Schemas) map[string]fieldInfo {
result := map[string]fieldInfo{} result := map[string]fieldInfo{}
for name, field := range schema.ResourceFields { for name, field := range schema.ResourceFields {
if strings.EqualFold(name, "id") {
continue
}
result[field.CodeName] = fieldInfo{ result[field.CodeName] = fieldInfo{
Name: name, Name: name,
Type: getGoType(field, schema, schemas), Type: getGoType(field, schema, schemas),

View File

@@ -1,5 +1,9 @@
package types package types
const (
ResourceFieldID = "id"
)
type Collection struct { type Collection struct {
Type string `json:"type,omitempty"` Type string `json:"type,omitempty"`
Links map[string]string `json:"links"` Links map[string]string `json:"links"`