Skip to content

Commit

Permalink
Make sure default package for property type is imported
Browse files Browse the repository at this point in the history
  • Loading branch information
kklimonda-cl committed Dec 13, 2024
1 parent 8be0912 commit 141304e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions pkg/properties/normalized.go
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ func (o *SpecParam) HasEntryName() bool {
return o.Items.Type == "entry"
}

func (o *SpecParam) DefaultType() string {
return o.Type
}

func (o *SpecParam) ValidatorType() string {
if o.Type == "" {
return "object"
Expand Down
3 changes: 3 additions & 0 deletions pkg/translate/terraform_provider/funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -1237,6 +1237,9 @@ func createSchemaAttributeForParameter(schemaTyp properties.SchemaType, manager

var defaultValue *defaultCtx
if schemaTyp == properties.SchemaResource && param.Default != "" {
defaultImport := fmt.Sprintf("github.com/hashicorp/terraform-plugin-framework/resource/schema/%sdefault", param.DefaultType())
manager.AddHashicorpImport(defaultImport, "")

var value string
switch param.Type {
case "string":
Expand Down

0 comments on commit 141304e

Please sign in to comment.