Skip to content

Commit 3db3569

Browse files
[Fix] Correctly generate classes with nested body fields (#808)
## Changes Correctly generate classes with nested body fields. ### Backwards incompatible changes The next time code is generated, the following backward incompatible changes will happen: * Removal of the following classes: `apps.CreateAppDeploymentRequest`, `apps.CreateAppRequest`, `apps.UpdateAppRequest`, `catalog.CreateOnlineTableRequest`, `dashboards.CreateDashboardRequest`, `dashboards.CreateScheduleRequest`, `dashboards.CreateSubscriptionRequest`, `dashboards.UpdateDashboardRequest` and `dashboards.UpdateScheduleRequest` * Change of signature for the following methods: `AppsAPI.create`, `AppsAPI.create_and_wait`, `AppsAPI.deploy`, `AppsAPI.deploy_and_wait`, `AppsAPI.update`, `OnlineTablesAPI.create`, `OnlineTablesAPI.create_and_wait`, `LakeviewAPI.create`, `LakeviewAPI.create_schedule`, `LakeviewAPI.create_subscription`, `LakeviewAPI.update` and `LakeviewAPI.update_schedule`. Each of those methods now take an object instead of a list of parameters. ## Tests Preview 66ce450 - [ ] `make test` run locally - [ ] `make fmt` applied - [ ] relevant integration tests applied
1 parent 52a2955 commit 3db3569

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

.codegen/service.py.tmpl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,9 @@ class {{.PascalName}}API:{{if .Description}}
240240
{{- end}}
241241

242242
{{define "method-serialize" -}}
243+
{{if and .Request.HasJsonField .RequestBodyField -}}
244+
body = {{template "safe-snake-name" .RequestBodyField}}
245+
{{- else -}}
243246
{{if or .Request.HasJsonField .Request.HasQueryField -}}
244247
{{if .Request.HasJsonField}}body = {}{{end}}{{if .Request.HasQueryField}}
245248
query = {}{{end}}
@@ -251,6 +254,7 @@ class {{.PascalName}}API:{{if .Description}}
251254
{{- end}}
252255
{{- end}}
253256
{{- end}}
257+
{{- end}}
254258
{{- end}}
255259

256260
{{ define "method-headers" -}}

0 commit comments

Comments
 (0)