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
  • #8553
Closed
Open
Issue created Jan 27, 2021 by Administrator@rootContributor4 of 6 checklist items completed4/6 checklist items

[BUG][Warning] [Java] [WebClient] BodyInserters.fromObject is deprecated since Spring 5.2

Created by: kelianClerc

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

Since Spring 5.2, BodyInserters.fromObject method has been deprecated. It is recommended to use BodyInserters.fromValue instead : see ref

BodyInserters.fromObject is used in ApiClient's selectBody method :

https://github.com/OpenAPITools/openapi-generator/blob/f19f7064bed355269f5e9c8a585afb9537ebef20/modules/openapi-generator/src/main/resources/Java/libraries/webclient/ApiClient.mustache#L495-L517

This leads to a warning during code generation :

[WARNING] COMPILATION WARNING : [INFO] ------------------------------------------------------------- [WARNING] .../src/gen/java/main/org/openapitools/client/ApiClient.java:[483,47] fromObject(T) in org.springframework.web.reactive.function.BodyInserters has been deprecated

openapi-generator version

5.0.0

OpenAPI declaration file content or url

Input file doesn't matter here

Generation Details

<configuration>
    <generatorName>java</generatorName>
    <configOptions>
        <sourceFolder>src/gen/java/main</sourceFolder>
        <java8>true</java8>
        <dateLibrary>java8</dateLibrary>
        <library>webclient</library>
        <openApiNullable>false</openApiNullable>
    </configOptions>
</configuration>
Steps to reproduce

run openapi-generator 5.0.0 with specified generation details

Related issues/PRs

none

Suggest a fix

Replacing :


return obj != null ? BodyInserters.fromObject(obj) : null; 

by :


return obj != null ? BodyInserters.fromValue(obj) : null; 
Assignee
Assign to
Time tracking