Skip to content

Commit

Permalink
fixed apps and dashboard command generation
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewnester committed Nov 8, 2024
1 parent da4b856 commit 91ad4df
Show file tree
Hide file tree
Showing 4 changed files with 50 additions and 67 deletions.
7 changes: 5 additions & 2 deletions .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,9 @@ func new{{.PascalName}}() *cobra.Command {
{{- if .Request}}

var {{.CamelName}}Req {{.Service.Package.Name}}.{{.Request.PascalName}}
{{- if .RequestBodyField }}
{{.CamelName}}Req.{{.RequestBodyField.PascalName}} = &{{.Service.Package.Name}}.{{.RequestBodyField.Entity.PascalName}}{}
{{- end }}
{{- if .CanUseJson}}
var {{.CamelName}}Json flags.JsonFlag
{{- end}}
Expand Down Expand Up @@ -232,7 +235,7 @@ func new{{.PascalName}}() *cobra.Command {
{{- if .Request }}
{{ if .CanUseJson }}
if cmd.Flags().Changed("json") {
diags := {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req)
diags := {{.CamelName}}Json.Unmarshal(&{{.CamelName}}Req{{ if .RequestBodyField }}.{{.RequestBodyField.PascalName}}{{ end }})
if diags.HasError() {
return diags.Error()
}
Expand Down Expand Up @@ -392,7 +395,7 @@ func new{{.PascalName}}() *cobra.Command {
if err != nil {
return fmt.Errorf("invalid {{$field.ConstantName}}: %s", args[{{$arg}}])
}{{else -}}
{{$method.CamelName}}Req.{{$field.PascalName}} = args[{{$arg}}]
{{$method.CamelName}}Req.{{ if $method.RequestBodyField }}{{$method.RequestBodyField.PascalName}}.{{end}}{{$field.PascalName}} = args[{{$arg}}]
{{- end -}}
{{- if $optionalIfJsonIsUsed }}
}
Expand Down
39 changes: 24 additions & 15 deletions cmd/workspace/apps/apps.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 19 additions & 49 deletions cmd/workspace/lakeview/lakeview.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 91ad4df

Please sign in to comment.