Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Make all type names PascalCase
  • Loading branch information
justinvp committed May 20, 2023
commit f90e016d105d3ed8e11ed0ceb61494878eb2de4c
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module github.com/pulumi/crd2pulumi
go 1.19

require (
github.com/iancoleman/strcase v0.2.0
github.com/pulumi/pulumi/pkg/v3 v3.59.1-0.20230323225522-946074865b11
github.com/pulumi/pulumi/sdk/v3 v3.59.1-0.20230323225522-946074865b11
github.com/spf13/cobra v1.6.1
Expand Down Expand Up @@ -119,7 +120,6 @@ require (
github.com/hashicorp/vault/api v1.8.2 // indirect
github.com/hashicorp/vault/sdk v0.6.1 // indirect
github.com/hashicorp/yamux v0.1.1 // indirect
github.com/iancoleman/strcase v0.2.0 // indirect
github.com/ijc/Gotty v0.0.0-20170406111628-a8b993ba6abd // indirect
github.com/imdario/mergo v0.3.13 // indirect
github.com/inconshreveable/mousetrap v1.0.1 // indirect
Expand Down
5 changes: 2 additions & 3 deletions pkg/codegen/schema.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ import (
"sort"
"strconv"

"github.com/iancoleman/strcase"
"github.com/pulumi/crd2pulumi/internal/slices"
"github.com/pulumi/crd2pulumi/internal/unstruct"
pschema "github.com/pulumi/pulumi/pkg/v3/codegen/schema"
"github.com/pulumi/pulumi/sdk/v3/go/common/tokens"
"golang.org/x/text/cases"
"golang.org/x/text/language"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
)

Expand Down Expand Up @@ -141,7 +140,7 @@ func AddType(schema map[string]any, name string, types map[string]pschema.Comple
propertyDescription, _, _ := unstructured.NestedString(propertySchema, "description")
defaultValue, _, _ := unstructured.NestedFieldNoCopy(propertySchema, "default")
propertySpecs[propertyName] = pschema.PropertySpec{
TypeSpec: GetTypeSpec(propertySchema, name+cases.Title(language.Und).String(propertyName), types),
TypeSpec: GetTypeSpec(propertySchema, name+strcase.ToCamel(propertyName), types),
Description: propertyDescription,
Default: defaultValue,
}
Expand Down