You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
## Changes
This PR updates the OpenAPI spec for the Python SDK to
d136ad0541f036372601bad9a4382db06c3c912d. As part of this, we add some
protection against fields or methods in our spec that conflict with
reserved keywords in Python.
## Tests
<!--
How is this tested? Please see the checklist below and also describe any
other relevant tests
-->
- [ ] `make test` run locally
- [ ] `make fmt` applied
- [ ] relevant integration tests applied
{{else if .ArrayValue}}type {{.PascalName}} []{{template "type" .ArrayValue}}
@@ -56,10 +56,10 @@ class {{.PascalName}}{{if eq "List" .PascalName}}Request{{end}}:{{if .Descriptio
56
56
{{- define "as_request_type" -}}
57
57
{{- if not .Entity }}None # ERROR: No Type
58
58
{{- /* This should be done recursively, but recursion in text templates is not supported. */ -}}
59
-
{{- else if .Entity.ArrayValue }}[{{if or .Entity.ArrayValue.IsObject .Entity.ArrayValue.IsExternal}}v.as_dict(){{ else if .Entity.ArrayValue.Enum }}v.value{{else}}v{{end}} for v in self.{{.SnakeName}}]
60
-
{{- else if or .Entity.IsObject .Entity.IsExternal }}self.{{.SnakeName}}.as_dict()
61
-
{{- else if .Entity.Enum }}self.{{.SnakeName}}.value
62
-
{{- else}}self.{{.SnakeName}}{{- end -}}
59
+
{{- else if .Entity.ArrayValue }}[{{if or .Entity.ArrayValue.IsObject .Entity.ArrayValue.IsExternal}}v.as_dict(){{ else if .Entity.ArrayValue.Enum }}v.value{{else}}v{{end}} for v in self.{{template "safe-snake-name" .}}]
60
+
{{- else if or .Entity.IsObject .Entity.IsExternal }}self.{{template "safe-snake-name" .}}.as_dict()
61
+
{{- else if .Entity.Enum }}self.{{template "safe-snake-name" .}}.value
62
+
{{- else}}self.{{template "safe-snake-name" .}}{{- end -}}
63
63
{{- end -}}
64
64
{{- define "type" -}}
65
65
{{- if not . }}any # ERROR: No Type
@@ -113,22 +113,22 @@ class {{.Name}}API:{{if .Description}}
@@ -297,14 +297,14 @@ class {{.Name}}API:{{if .Description}}
297
297
{{define "method-do" -}}
298
298
self._api.do('{{.Verb}}',
299
299
{{if .PathParts -}}
300
-
f'{{range .PathParts}}{{.Prefix}}{{if .Field}}{{"{"}}{{.Field.SnakeName}}{{with .Field.Entity.Enum}}.value{{end}}{{"}"}}{{else if .IsAccountId}}{{"{self._api.account_id}"}}{{end}}{{ end }}'
300
+
f'{{range .PathParts}}{{.Prefix}}{{if .Field}}{{"{"}}{{template "safe-snake-name" .Field}}{{with .Field.Entity.Enum}}.value{{end}}{{"}"}}{{else if .IsAccountId}}{{"{self._api.account_id}"}}{{end}}{{ end }}'
301
301
{{- else}}'{{.Path}}'{{end}}
302
302
{{if .Request}}
303
303
{{- if .Request.HasQueryField}}, query=query{{end}}
304
304
{{- if .Request.HasJsonField}}, body=body{{end}}
305
305
{{end}}
306
306
, headers=headers
307
-
{{- if and .IsRequestByteStream .RequestBodyField }}, data={{.RequestBodyField.SnakeName}}{{ end }}
307
+
{{- if and .IsRequestByteStream .RequestBodyField }}, data={{template "safe-snake-name" .RequestBodyField}}{{ end }}
308
308
{{- if .IsResponseByteStream }}, raw=True{{ end }})
0 commit comments