When a map or slice-typed query parameter has x-go-type-skip-optional-pointer: true set, the generated type correctly lacks a pointer, but the generated client code in the New*Request assumes one, leading to a compilation error in the generated code.
oadpi-codegen version: 2.6.0 and latest main (c2095464aea566dafda7ff63b66b0f7e4fb51b42)
Go version: 1.25.0
Here's a simple repro case:
spec.yaml:
openapi: "3.0.0"
info:
title: Reproduction
version: "1.0"
paths:
/things:
get:
operationId: listThings
parameters:
- name: tags
in: query
style: deepObject
x-go-type-skip-optional-pointer: true
schema:
type: object
additionalProperties:
type: string
responses:
"200":
description: OK
content:
application/json:
schema:
type: object
properties:
items:
type: array
items:
type: string
config.yaml
package: api
generate:
client: true
models: true
output: api.gen.go
The generated params struct correctly omits the pointer:
type ListThingsParams struct {
Tags map[string]string `json:"tags,omitempty"`
}
But the generated client code still tries to dereference it:
if params.Tags != nil {
if queryFrag, err := runtime.StyleParamWithOptions("deepObject", true, "tags", *params.Tags, ...); err != nil {
// ^^^^^^^^^^^^^
// BUG: cannot indirect a map
When a map or slice-typed query parameter has
x-go-type-skip-optional-pointer: trueset, the generated type correctly lacks a pointer, but the generated client code in theNew*Requestassumes one, leading to a compilation error in the generated code.oadpi-codegen version: 2.6.0 and latest
main(c2095464aea566dafda7ff63b66b0f7e4fb51b42)Go version: 1.25.0
Here's a simple repro case:
spec.yaml:config.yamlThe generated params struct correctly omits the pointer:
But the generated client code still tries to dereference it: