From 11c0ce24e69bbe2b0c948b73881776d8a2b16981 Mon Sep 17 00:00:00 2001 From: Lisa Karlin Curtis Date: Fri, 14 Jun 2024 20:58:26 +0100 Subject: [PATCH] Change to a simpler data structure This means we use ['group','user'] instead of [{'attribute_id':'group','attribute_id':'user'}] --- output/marshal.go | 4 ++-- output/output.go | 20 ++++++++------------ 2 files changed, 10 insertions(+), 14 deletions(-) diff --git a/output/marshal.go b/output/marshal.go index ba59c1a..58f8770 100644 --- a/output/marshal.go +++ b/output/marshal.go @@ -71,9 +71,9 @@ func MarshalType(output *Output) (base *CatalogTypeModel, enumTypes []*CatalogTy } if attr.Path != nil { - attribute.Path = lo.ToPtr(lo.Map(attr.Path, func(item *PathAttribute, _ int) client.CatalogTypeAttributePathItemPayloadV2 { + attribute.Path = lo.ToPtr(lo.Map(attr.Path, func(item string, _ int) client.CatalogTypeAttributePathItemPayloadV2 { return client.CatalogTypeAttributePathItemPayloadV2{ - AttributeId: item.AttributeId, + AttributeId: item, } })) } diff --git a/output/output.go b/output/output.go index 64ece44..fac0924 100644 --- a/output/output.go +++ b/output/output.go @@ -47,19 +47,15 @@ func (s SourceConfig) Validate() error { ) } -type PathAttribute struct { - AttributeId string `json:"attribute_id"` -} - type Attribute struct { - ID string `json:"id"` - Name string `json:"name"` - Type null.String `json:"type"` - Array bool `json:"array"` - Source null.String `json:"source"` - Enum *AttributeEnum `json:"enum"` - BacklinkAttribute null.String `json:"backlink_attribute"` - Path []*PathAttribute `json:"path"` + ID string `json:"id"` + Name string `json:"name"` + Type null.String `json:"type"` + Array bool `json:"array"` + Source null.String `json:"source"` + Enum *AttributeEnum `json:"enum"` + BacklinkAttribute null.String `json:"backlink_attribute"` + Path []string `json:"path"` } func (a Attribute) Validate() error {