Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • O openapi-generator
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,476
    • Issues 3,476
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 402
    • Merge requests 402
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • OpenAPI Tools
  • openapi-generator
  • Issues
  • #7118
Closed
Open
Issue created Aug 03, 2020 by Administrator@rootContributor

[REQ] Handle list of String special case in webclient generator

Created by: dlicois

Is your feature request related to a problem? Please describe.

When describing an operation that returns an array of string, the openapi-generator for java-webclient generates an api returning a Flux<String>.

However Spring's Webclient handles serialization of JSON array of strings in a special way : spring-projects/spring-framework#22662

This means expecting a Flux<String> when a server return an array of String is a mistake.

Please see sample Gradle project https://github.com/dlicois/webclient-liststring, it contains a test class (WebClientListStringTest.java) to better explain the behaviour. The openapi.yaml describes an operation returning an array of string, openapi-generator generates a DefaultApi.java class returning a Flux<String>. When the webclient receive the answer ["one","two", "three"], it publishes a single String of value ["one","two", "three"]. I would have expected three Strings.

This makes the generated api unusable for this case, requiring to parse the response a second time to handle it.

Describe the solution you'd like

Recommended solution by Spring developers (see spring-projects/spring-framework#22662 and https://docs.spring.io/spring/docs/current/spring-framework-reference/web-reactive.html#webflux-codecs-jackson) is to use a Mono<List> for string arrays.

This would mean making a special case for operations described as arrays of string to generate a Mono<List> instead of Flux.

Assignee
Assign to
Time tracking