-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Description
Bug Report Checklist
- Have you provided a full/minimal spec to reproduce the issue?
- Have you validated the input using an OpenAPI validator (example)?
- Have you tested with the latest master to confirm the issue still exists?
- Have you searched for related issues/PRs?
- What's the actual output vs expected output?
- [Optional] Sponsorship to speed up the bug fix or feature request (example)
Description
When generating a reactive controller that should return a JSON array of strings should generate a method that returns Mono<ResponseEntity<List> or Mono<ResponseEntity<Set> depending on the uniqueItems flag instead of Flux.
Related Spring documentation: https://docs.spring.io/spring-framework/reference/web/webflux/reactive-spring.html#webflux-codecs-jackson
Related Stackoverflow question: https://stackoverflow.com/questions/48421597/returning-fluxstring-from-spring-webflux-returns-one-string-instead-of-array-o
openapi-generator version
7.7.0
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: OpenAPI Petstore
description: "sample to get all user id as string list and string set"
version: 1.0.0
tags: []
paths:
/users/id?type=set:
get:
operationId: getUserIdSet
tags:
- users
responses:
'200':
description: response
content:
application/json:
schema:
type: array
"uniqueItems": true
"items":
"type": "string"
/users/id?type=list:
get:
operationId: getUserIdList
tags:
- users
responses:
'200':
description: response
content:
application/json:
schema:
type: array
"uniqueItems": false
"items":
"type": "string"
Generation Details
Maven settings used:
<configuration>
<inputSpec>${project.basedir}/api/api.yaml</inputSpec>
<generatorName>spring</generatorName>
<generateApis>true</generateApis>
<generateModels>true</generateModels>
<!-- configuration -->
<configOptions>
<interfaceOnly>true</interfaceOnly>
<sourceFolder>/src/main/java</sourceFolder>
<useSpringBoot3>true</useSpringBoot3>
<reactive>true</reactive>
</configOptions>
</configuration>
Steps to reproduce
- Set up project
- mvn clean compile
Related issues/PRs
Related but affecting the Java client
#16326
Suggest a fix
In case there there is an endpoint with application/json content type, create an exception to generate a collected collection of strings, the Kotlin Spring generator is affected too