Skip to content

Commit

Permalink
Change to a simpler data structure
Browse files Browse the repository at this point in the history
This means we use ['group','user'] instead of [{'attribute_id':'group','attribute_id':'user'}]
  • Loading branch information
paprikati committed Jun 14, 2024
1 parent a554617 commit 11c0ce2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
4 changes: 2 additions & 2 deletions output/marshal.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
}))
}
Expand Down
20 changes: 8 additions & 12 deletions output/output.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 11c0ce2

Please sign in to comment.