Skip to content
This repository has been archived by the owner on Dec 30, 2024. It is now read-only.

Commit

Permalink
fix: CustomType for SingleTypeOf attribute (#60)
Browse files Browse the repository at this point in the history
* fix: CustomType for SingleTypeOf attribute

* ci(generate): changes by go generate

* chore: add changelog

---------

Co-authored-by: azrod <[email protected]>
  • Loading branch information
azrod and azrod authored Nov 6, 2023
1 parent 9b08c28 commit df52cf5
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .changelog/60.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
`SingleNestedAttributeOf` - Fix custom type for Single Nested Attribute of
```
4 changes: 2 additions & 2 deletions supersingle_nested_attribute.go
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ func (s SuperSingleNestedAttributeOf[T]) GetResource(ctx context.Context) schema
}
// * If user has not provided a custom type, we will use the default supertypes
if a.CustomType == nil {
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx).ObjectType
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx)
}

deprecationMessage := ""
Expand Down Expand Up @@ -299,7 +299,7 @@ func (s SuperSingleNestedAttributeOf[T]) GetDataSource(ctx context.Context) sche
}
// * If user has not provided a custom type, we will use the default supertypes
if a.CustomType == nil {
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx).ObjectType
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx)
}

deprecationMessage := ""
Expand Down
4 changes: 2 additions & 2 deletions supertype_attribute.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ func (s Super{{ .TypeName }}AttributeOf[T]) GetResource(ctx context.Context) sch
{{- if or (eq .TypeName "SingleNested") }}
// * If user has not provided a custom type, we will use the default supertypes
if a.CustomType == nil {
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx).ObjectType
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx)
}
{{- end }}

Expand Down Expand Up @@ -593,7 +593,7 @@ func (s Super{{ .TypeName }}AttributeOf[T]) GetDataSource(ctx context.Context) s
{{- if or (eq .TypeName "SingleNested") }}
// * If user has not provided a custom type, we will use the default supertypes
if a.CustomType == nil {
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx).ObjectType
a.CustomType = supertypes.NewSingleNestedObjectTypeOf[T](ctx)
}
{{- end }}

Expand Down

0 comments on commit df52cf5

Please sign in to comment.