Bug Report Checklist
Description
When enum parameters (referenced via $ref in OpenAPI specs) are used as query parameters, the generated code attempts to call .to_string() on Option. This causes Rust's type inference to fail because it can
t distinguish between primitive types and enums/models.
It's generating code like this:
if let Some(ref param_value) = time_bucket {
req_builder = req_builder.query(&[("timeBucket", ¶m_value.to_string())]);
but it should probably be:
if let Some(ref param_value) = time_bucket {
req_builder = req_builder.query(&[("timeBucket", &serde_json::to_string(param_value)?)]);
openapi-generator version
7.11.0
OpenAPI declaration file content or url
openapi: 3.0.3
info:
title: Minimal Enum Query Param Test
version: 1.0.0
paths:
/data:
get:
operationId: getData
parameters:
- name: timeBucket
in: query
required: false
schema:
$ref: '#/components/schemas/TimeBucket'
responses:
'200':
description: OK
components:
schemas:
TimeBucket:
type: string
enum:
- day
- month
- year
EOF)
⎿ openapi: 3.0.3
info:
title: Minimal Enum Query Param Test
version: 1.0.0
paths:
/data:
get:
operationId: getData
parameters:
- name: timeBucket
in: query
required: false
schema:
$ref: '#/components/schemas/TimeBucket'
responses:
'200':
description: OK
components:
schemas:
TimeBucket:
type: string
enum:
- day
- month
- year
I will be creating a PR to propose a fix.
Bug Report Checklist
Description
When enum parameters (referenced via $ref in OpenAPI specs) are used as query parameters, the generated code attempts to call .to_string() on Option. This causes Rust's type inference to fail because it can
t distinguish between primitive types and enums/models.
It's generating code like this:
but it should probably be:
openapi-generator version
7.11.0
OpenAPI declaration file content or url
I will be creating a PR to propose a fix.