-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Open
Description
Is your feature request related to a problem? Please describe.
Kotlin openapi-generator ignores style: deepObject
explode: true
query param options.
Spec (click to view)
openapi: 3.0.0
...
paths:
/tags/:
get:
summary: Get all tags
parameters:
- $ref: '#/components/parameters/TagsFilter'
responses:
"200":
description: Array of tags
content:
application/json:
schema:
type: object
properties:
meta:
$ref: '#/components/schemas/ListMetaInfo'
data:
type: array
items:
$ref: '#/components/schemas/TagModel'
"400":
$ref: '#/components/responses/BadRequest'
default:
$ref: '#/components/responses/ServerError'
...
parameters:
TagsFilter:
name: filter
description: |
Tag filter. Should be serialized as:
filter[filter1name]=filter1val&filter[filter2name]=filter2val.
in: query
required: false
schema:
type: object
properties:
important:
type: boolean
description: |
Important tags only.
example: true
style: deepObject
explode: true
...
The output produced:
data class Filter (
@Json(name = "important")
val important: kotlin.Boolean? = null
)
@GET("tags/")
suspend fun tagsGet(@Query("filter") filter: Filter? = null): Response<InlineResponse2001>
Actual: https://host/tags/?filter=Filter%28important%3Dtrue%29
Expected: https://host/tags/?filter[important]=true
Describe the solution you'd like
Unfortunately, retrofit2 doesn't have advanced custom parameter type handling yet.
See square/retrofit#626 for details.
Suggested workaround:
suspend fun tagsGet(filter: Filter? = null) = tagsGet(filter?.important)
@GET("tags/")
suspend fun tagsGet(@Query("filter[important]") filterImportant: Boolean? = null): Response<InlineResponse2001>
chetanya95