Skip to content

Commit

Permalink
fix java exception in apex codegen (#1395)
Browse files Browse the repository at this point in the history
  • Loading branch information
wing328 authored Nov 7, 2018
1 parent 5849dba commit 3494542
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -35,8 +36,6 @@
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);

Expand Down Expand Up @@ -325,7 +324,7 @@ public String toExampleValue(Schema p) {
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}")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.swagger.v3.oas.models.OpenAPI;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.io.File;
import java.util.*;

Expand Down Expand Up @@ -224,7 +225,7 @@ public String toDefaultValue(Schema p) {
);
} 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";
Expand Down
2 changes: 1 addition & 1 deletion samples/client/petstore/apex/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0-SNAPSHOT
3.3.3-SNAPSHOT

0 comments on commit 3494542

Please sign in to comment.