-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[JAVA] Client generated with deprecated code. #1053
Comments
+1 |
Have you considered the
|
I ran into this same problem today while using Looks like the java generator is pinned to use If you use your own Confirmed this is still happening as of the |
I ran into the same problem using the latest |
I am running into the same problem using the v4.2.3 release and dateLibrary: java8. |
There's a PR to address it - #5786 Can you please test to see if it resolves the issue? |
I have confirmed the issue has been resolved by the latest release v5.0.0-beta2. The package org.openapitools;
import com.fasterxml.jackson.databind.util.StdDateFormat;
import java.text.DateFormat;
import java.text.FieldPosition;
import java.text.ParsePosition;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.TimeZone;
public class RFC3339DateFormat extends DateFormat {
private static final long serialVersionUID = 1L;
private static final TimeZone TIMEZONE_Z = TimeZone.getTimeZone("UTC");
private final StdDateFormat fmt = new StdDateFormat()
.withTimeZone(TIMEZONE_Z)
.withColonInTimeZone(true);
public RFC3339DateFormat() {
this.calendar = new GregorianCalendar();
}
@Override
public Date parse(String source, ParsePosition pos) {
return fmt.parse(source, pos);
}
@Override
public StringBuffer format(Date date, StringBuffer toAppendTo, FieldPosition fieldPosition) {
return fmt.format(date, toAppendTo, fieldPosition);
}
@Override
public Object clone() {
return this;
}
} The command I executed to test is below: $ docker run --rm -v "${PWD}:/local" openapitools/openapi-generator-cli:v5.0.0-beta2 generate -i https://raw.githubusercontent.com/zawataki/sample-api-interface/master/yaml-unresolved/swagger.yaml -g spring -o /local/5.0.0-beta2-spring --additional-properties=dateLibrary=java8 |
@emile-jumo Can you close this issue because the issue has been resolved? Thank you. |
Description
I use swagger to define my API and generate clients form the swagger spec. When I generated the Java client using swagger-codegen a class called
RFC3339DateFormat.java
was generated and it extendsISO8601DateFormat
which is deprecated.Do you suggest that I replace it manually with the preferred class
StdDateFormat
? Or is there configuration that I should set to useStdDateFormat
rather.Swagger-codegen version
2.3.1
Configuration
config.json:
The text was updated successfully, but these errors were encountered: