@@ -450,3 +450,43 @@ func TestReflector_SetupRequest(t *testing.T) {
450450
451451 assertjson .Equal (t , expected , b , string (b ))
452452}
453+
454+ func TestReflector_SetupRequest_queryObject (t * testing.T ) {
455+ reflector := openapi3.Reflector {}
456+ op := openapi3.Operation {}
457+
458+ s := reflector .SpecEns ()
459+ s .Info .Title = apiName
460+ s .Info .Version = apiVersion
461+
462+ require .NoError (t , reflector .SetupRequest (openapi3.OperationContext {
463+ Operation : & op ,
464+ HTTPMethod : http .MethodGet ,
465+ Input : new (struct {
466+ InQuery map [int ]float64 `query:"in_query"`
467+ }),
468+ }))
469+ require .NoError (t , s .AddOperation (http .MethodPost , "/somewhere" , op ))
470+
471+ b , err := assertjson .MarshalIndentCompact (s , "" , " " , 120 )
472+ assert .NoError (t , err )
473+
474+ expected := []byte (`{
475+ "openapi":"3.0.2","info":{"title":"SampleAPI","version":"1.2.3"},
476+ "paths":{
477+ "/somewhere":{
478+ "post":{
479+ "parameters":[
480+ {
481+ "name":"in_query","in":"query","style":"deepObject","explode":true,
482+ "schema":{"type":"object","additionalProperties":{"type":"number"}}
483+ }
484+ ],
485+ "responses":{"204":{"description":"No Content"}}
486+ }
487+ }
488+ }
489+ }` )
490+
491+ assertjson .Equal (t , expected , b , string (b ))
492+ }
0 commit comments