mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-07 10:58:55 +00:00
fix java exception in apex codegen (#1395)
This commit is contained in:
parent
5849dbaaca
commit
34945427d4
@ -18,6 +18,7 @@
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.CodegenConfig;
|
||||
@ -35,8 +36,6 @@ import io.swagger.v3.oas.models.responses.ApiResponse;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
||||
|
||||
public abstract class AbstractApexCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(AbstractApexCodegen.class);
|
||||
|
||||
@ -325,7 +324,7 @@ public abstract class AbstractApexCodegen extends DefaultCodegen implements Code
|
||||
if (example.isEmpty()) {
|
||||
example = "VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wZWQgb3ZlciB0aGUgbGF6eSBkb2cu";
|
||||
}
|
||||
((ByteArraySchema) p).setExample(example);
|
||||
p.setExample(example);
|
||||
example = "EncodingUtil.base64Decode('" + example + "')";
|
||||
} else if (ModelUtils.isDateSchema(p)) {
|
||||
if (example.matches("^\\d{4}(-\\d{2}){2}")) {
|
||||
|
@ -26,6 +26,7 @@ import io.swagger.v3.oas.models.info.*;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
||||
@ -224,7 +225,7 @@ public class ApexClientCodegen extends AbstractApexCodegen {
|
||||
);
|
||||
} else if (ModelUtils.isBooleanSchema(p)) {
|
||||
// true => "true", false => "false", null => "null"
|
||||
out = String.valueOf(((BooleanSchema) p).getDefault());
|
||||
out = String.valueOf(p.getDefault());
|
||||
} else if (ModelUtils.isLongSchema(p)) {
|
||||
Long def = (Long) p.getDefault();
|
||||
out = def == null ? out : def.toString() + "L";
|
||||
|
@ -1 +1 @@
|
||||
3.2.0-SNAPSHOT
|
||||
3.3.3-SNAPSHOT
|
Loading…
Reference in New Issue
Block a user