OpenAPI Generator allows generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)
[BUG] Version 7.7.0: Generating java.net.URLEncoder.encode(String, String) instead of the preferable one java.net.URLEncoder.encode(String, Charset) #19370
Version 7.7.0:
Generating java.net.URLEncoder.encode(String, String) instead of the preferable one java.net.URLEncoder.encode(String, Charset)
Problem is when I am using org.gaul:modernizer-maven-plugin:2.7.0:modernizer (modernizer) on project it is forcing the build to fail as the generated code is not using the most preferable method signature i.e. java.net.URLEncoder.encode(String, Charset)
spring-boot-starter-parent version : 2.7.7
java version : 11
openapi-generator-maven-plugin version : 7.7.0
openapi-generator-maven-plugin version : 2.7.0
generatorName : java using with "resttemplate" library.
Error:
openapi-generator version
7.7.0
OpenAPI declaration file content or url
openapi: 3.0.1
info:
title: Sample API
description: A simple API example
version: 1.0.0
paths:
/greet:
get:
summary: Greet the user
parameters:
- name: name
in: query
required: true
schema:
type: string
responses:
'200':
description: A greeting message
content:
application/json:
schema:
type: object
properties:
message:
type: string
example: Hello, World!
Description
Version 7.7.0: Generating java.net.URLEncoder.encode(String, String) instead of the preferable one java.net.URLEncoder.encode(String, Charset)
Problem is when I am using org.gaul:modernizer-maven-plugin:2.7.0:modernizer (modernizer) on project it is forcing the build to fail as the generated code is not using the most preferable method signature i.e. java.net.URLEncoder.encode(String, Charset)
spring-boot-starter-parent version : 2.7.7 java version : 11 openapi-generator-maven-plugin version : 7.7.0 openapi-generator-maven-plugin version : 2.7.0 generatorName : java using with "resttemplate" library.
Error:
openapi-generator version
7.7.0
OpenAPI declaration file content or url
Generation Details
Steps to reproduce
Prepare a simple springboot project using the pom.xml and api-spec.yaml and run mvn clean install
Error:
.zip file of the project is also included as attachment.
open-api-demo.zip
Suggest a fix