mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-07-03 22:20:56 +00:00
Improve generated Java examples (#8012)
* Add basic types imports to generated examples This adds an extension to include basic types imports to generated Java examples. * Make some fixes to example generation * Generate OffsetDatetime correctly * Create a useful sample for enums, regenerate samples * Fix BigDecimal as well
This commit is contained in:
parent
157ad1ce73
commit
616b44f3b1
@ -21,10 +21,12 @@ import com.google.common.base.Strings;
|
||||
import io.swagger.v3.oas.models.OpenAPI;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.examples.Example;
|
||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||
import io.swagger.v3.oas.models.media.ComposedSchema;
|
||||
import io.swagger.v3.oas.models.media.Schema;
|
||||
import io.swagger.v3.oas.models.media.StringSchema;
|
||||
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||
import io.swagger.v3.oas.models.servers.Server;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
@ -931,6 +933,37 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
return super.toDefaultValue(schema);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the example value of the parameter. Overrides the
|
||||
* setParameterExampleValue(CodegenParameter, Parameter) method in
|
||||
* DefaultCodegen to always call setParameterExampleValue(CodegenParameter)
|
||||
* in this class, which adds single quotes around strings from the
|
||||
* x-example property.
|
||||
*
|
||||
* @param codegenParameter Codegen parameter
|
||||
* @param parameter Parameter
|
||||
*/
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter codegenParameter, Parameter parameter) {
|
||||
if (parameter.getExample() != null) {
|
||||
codegenParameter.example = parameter.getExample().toString();
|
||||
}
|
||||
|
||||
if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) {
|
||||
Example example = parameter.getExamples().values().iterator().next();
|
||||
if (example.getValue() != null) {
|
||||
codegenParameter.example = example.getValue().toString();
|
||||
}
|
||||
}
|
||||
|
||||
Schema schema = parameter.getSchema();
|
||||
if (schema != null && schema.getExample() != null) {
|
||||
codegenParameter.example = schema.getExample().toString();
|
||||
}
|
||||
|
||||
setParameterExampleValue(codegenParameter);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setParameterExampleValue(CodegenParameter p) {
|
||||
String example;
|
||||
@ -959,15 +992,17 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
if (example == null) {
|
||||
example = "56";
|
||||
}
|
||||
example = example + "L";
|
||||
example = StringUtils.appendIfMissingIgnoreCase(example, "L");
|
||||
} else if ("Float".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
example = example + "F";
|
||||
example = StringUtils.appendIfMissingIgnoreCase(example, "F");
|
||||
} else if ("Double".equals(type)) {
|
||||
example = "3.4";
|
||||
example = example + "D";
|
||||
if (example == null) {
|
||||
example = "3.4";
|
||||
}
|
||||
example = StringUtils.appendIfMissingIgnoreCase(example, "D");
|
||||
} else if ("Boolean".equals(type)) {
|
||||
if (example == null) {
|
||||
example = "true";
|
||||
@ -979,6 +1014,14 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
example = "new File(\"" + escapeText(example) + "\")";
|
||||
} else if ("Date".equals(type)) {
|
||||
example = "new Date()";
|
||||
} else if ("OffsetDateTime".equals(type)) {
|
||||
example = "OffsetDateTime.now()";
|
||||
} else if ("BigDecimal".equals(type)) {
|
||||
example = "new BigDecimal(78)";
|
||||
} else if (p.allowableValues != null && !p.allowableValues.isEmpty()) {
|
||||
Map<String, Object> allowableValues = p.allowableValues;
|
||||
List<Object> values = (List<Object>) allowableValues.get("values");
|
||||
example = type + ".fromValue(\"" + String.valueOf(values.get(0)) + "\")";
|
||||
} else if (!languageSpecificPrimitives.contains(type)) {
|
||||
// type is a model class, e.g. User
|
||||
example = "new " + type + "()";
|
||||
@ -1141,6 +1184,18 @@ public abstract class AbstractJavaCodegen extends DefaultCodegen implements Code
|
||||
itr.remove();
|
||||
}
|
||||
}
|
||||
|
||||
Map<String, Object> operations = (Map<String, Object>) objs.get("operations");
|
||||
List<CodegenOperation> operationList = (List<CodegenOperation>) operations.get("operation");
|
||||
for (CodegenOperation op : operationList) {
|
||||
Collection<String> operationImports = new TreeSet<String>();
|
||||
for (CodegenParameter p : op.allParams) {
|
||||
if (importMapping.containsKey(p.dataType)) {
|
||||
operationImports.add(importMapping.get(p.dataType));
|
||||
}
|
||||
}
|
||||
op.vendorExtensions.put("x-java-import", operationImports);
|
||||
}
|
||||
return objs;
|
||||
}
|
||||
|
||||
|
@ -28,6 +28,9 @@ Method | HTTP request | Description
|
||||
### Example
|
||||
|
||||
```java
|
||||
{{#vendorExtensions.x-java-import}}
|
||||
import {{.}};
|
||||
{{/vendorExtensions.x-java-import}}
|
||||
// Import classes:
|
||||
import {{{invokerPackage}}}.ApiClient;
|
||||
import {{{invokerPackage}}}.ApiException;
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -226,6 +226,7 @@ Test serialization of outer number types
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.math.BigDecimal;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -239,7 +240,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -552,6 +553,10 @@ Fake endpoint for testing various parameters
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -571,7 +576,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -582,7 +587,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -520,6 +520,7 @@ uploads an image
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -592,6 +593,7 @@ uploads an image (required)
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
|
@ -487,7 +487,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
CompletableFuture<BigDecimal> result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result.get());
|
||||
@ -554,7 +554,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
CompletableFuture<ApiResponse<BigDecimal>> response = apiInstance.fakeOuterNumberSerializeWithHttpInfo(body);
|
||||
System.out.println("Status code: " + response.get().getStatusCode());
|
||||
@ -1204,7 +1204,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1215,7 +1215,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
@ -1303,7 +1303,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1314,7 +1314,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -459,7 +459,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -525,7 +525,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
ApiResponse<BigDecimal> response = apiInstance.fakeOuterNumberSerializeWithHttpInfo(body);
|
||||
System.out.println("Status code: " + response.getStatusCode());
|
||||
@ -1131,7 +1131,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1142,7 +1142,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
@ -1229,7 +1229,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1240,7 +1240,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -228,7 +228,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -542,7 +542,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -553,7 +553,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -228,7 +228,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -542,7 +542,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -553,7 +553,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
AsyncFile binary = new AsyncFile(); // AsyncFile | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
AsyncFile binary = new AsyncFile(); // AsyncFile | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -239,7 +239,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -568,7 +568,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -579,7 +579,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -222,6 +222,7 @@ Test serialization of outer number types
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.math.BigDecimal;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -235,7 +236,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -608,6 +609,10 @@ Fake endpoint for testing various parameters
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDate;
|
||||
import java.time.OffsetDateTime;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -627,7 +632,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -638,7 +643,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
@ -521,6 +521,7 @@ uploads an image
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
@ -593,6 +594,7 @@ uploads an image (required)
|
||||
### Example
|
||||
|
||||
```java
|
||||
import java.io.File;
|
||||
// Import classes:
|
||||
import org.openapitools.client.ApiClient;
|
||||
import org.openapitools.client.ApiException;
|
||||
|
@ -451,7 +451,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
BigDecimal result = apiInstance.fakeOuterNumberSerialize(body);
|
||||
System.out.println(result);
|
||||
@ -517,7 +517,7 @@ public class Example {
|
||||
defaultClient.setBasePath("http://petstore.swagger.io:80/v2");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal body = new BigDecimal(); // BigDecimal | Input number as post body
|
||||
BigDecimal body = new BigDecimal(78); // BigDecimal | Input number as post body
|
||||
try {
|
||||
ApiResponse<BigDecimal> response = apiInstance.fakeOuterNumberSerializeWithHttpInfo(body);
|
||||
System.out.println("Status code: " + response.getStatusCode());
|
||||
@ -1245,7 +1245,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1256,7 +1256,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
@ -1343,7 +1343,7 @@ public class Example {
|
||||
http_basic_test.setPassword("YOUR PASSWORD");
|
||||
|
||||
FakeApi apiInstance = new FakeApi(defaultClient);
|
||||
BigDecimal number = new BigDecimal(); // BigDecimal | None
|
||||
BigDecimal number = new BigDecimal(78); // BigDecimal | None
|
||||
Double _double = 3.4D; // Double | None
|
||||
String patternWithoutDelimiter = "patternWithoutDelimiter_example"; // String | None
|
||||
byte[] _byte = null; // byte[] | None
|
||||
@ -1354,7 +1354,7 @@ public class Example {
|
||||
String string = "string_example"; // String | None
|
||||
File binary = new File("/path/to/file"); // File | None
|
||||
LocalDate date = new LocalDate(); // LocalDate | None
|
||||
OffsetDateTime dateTime = new OffsetDateTime(); // OffsetDateTime | None
|
||||
OffsetDateTime dateTime = OffsetDateTime.now(); // OffsetDateTime | None
|
||||
String password = "password_example"; // String | None
|
||||
String paramCallback = "paramCallback_example"; // String | None
|
||||
try {
|
||||
|
Loading…
x
Reference in New Issue
Block a user