Skip to content

Commit

Permalink
Correctly handle required query params in CLI generation (#2027)
Browse files Browse the repository at this point in the history
## Changes
If there's required query params, it is a top-level field of request
object and not a field of nested request body.

This is needed for upcoming changes from OpenAPI spec changes where such
query parameters is introduced.

No changes after regenerating CLI with current spec and the fix (appears
we haven't had such params before)
  • Loading branch information
andrewnester authored Dec 17, 2024
1 parent 13fa43e commit 5b84856
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion .codegen/service.go.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -411,5 +411,5 @@ func new{{.PascalName}}() *cobra.Command {
{{- define "request-body-obj" -}}
{{- $method := .Method -}}
{{- $field := .Field -}}
{{$method.CamelName}}Req{{ if (and $method.RequestBodyField (not $field.IsPath)) }}.{{$method.RequestBodyField.PascalName}}{{end}}.{{$field.PascalName}}
{{$method.CamelName}}Req{{ if (and $method.RequestBodyField (and (not $field.IsPath) (not $field.IsQuery))) }}.{{$method.RequestBodyField.PascalName}}{{end}}.{{$field.PascalName}}
{{- end -}}

0 comments on commit 5b84856

Please sign in to comment.