From df52cf5e6d97813cdbf42bf0f404f600130ad2c7 Mon Sep 17 00:00:00 2001 From: Mickael Stanislas Date: Mon, 6 Nov 2023 10:43:21 +0100 Subject: [PATCH] fix: CustomType for SingleTypeOf attribute (#60) * fix: CustomType for SingleTypeOf attribute * ci(generate): changes by go generate * chore: add changelog --------- Co-authored-by: azrod --- .changelog/60.txt | 3 +++ supersingle_nested_attribute.go | 4 ++-- supertype_attribute.go.tmpl | 4 ++-- 3 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 .changelog/60.txt diff --git a/.changelog/60.txt b/.changelog/60.txt new file mode 100644 index 0000000..d3f39cb --- /dev/null +++ b/.changelog/60.txt @@ -0,0 +1,3 @@ +```release-note:bug +`SingleNestedAttributeOf` - Fix custom type for Single Nested Attribute of +``` \ No newline at end of file diff --git a/supersingle_nested_attribute.go b/supersingle_nested_attribute.go index 413662a..a01317a 100644 --- a/supersingle_nested_attribute.go +++ b/supersingle_nested_attribute.go @@ -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 := "" @@ -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 := "" diff --git a/supertype_attribute.go.tmpl b/supertype_attribute.go.tmpl index fcbb984..0502c5c 100644 --- a/supertype_attribute.go.tmpl +++ b/supertype_attribute.go.tmpl @@ -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 }} @@ -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 }}