mirror of
https://github.com/valitydev/openapi-generator.git
synced 2024-11-06 18:45:23 +00:00
* replaced setParameterExampleValue method * removed old method * fixed bool, test fix for objects * continued fix * double override * regenerated petstore client * regenerated oas3 sample * updated asyncio and tornado generated clients for CI
This commit is contained in:
parent
4b84821506
commit
3d92ea0eda
@ -17,8 +17,10 @@
|
|||||||
|
|
||||||
package org.openapitools.codegen.languages;
|
package org.openapitools.codegen.languages;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.models.examples.Example;
|
||||||
import io.swagger.v3.oas.models.media.ArraySchema;
|
import io.swagger.v3.oas.models.media.ArraySchema;
|
||||||
import io.swagger.v3.oas.models.media.Schema;
|
import io.swagger.v3.oas.models.media.Schema;
|
||||||
|
import io.swagger.v3.oas.models.parameters.Parameter;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.openapitools.codegen.*;
|
import org.openapitools.codegen.*;
|
||||||
@ -704,7 +706,7 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (example == null) {
|
if (example == null) {
|
||||||
example = "NULL";
|
example = "None";
|
||||||
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
} else if (Boolean.TRUE.equals(p.isListContainer)) {
|
||||||
example = "[" + example + "]";
|
example = "[" + example + "]";
|
||||||
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
} else if (Boolean.TRUE.equals(p.isMapContainer)) {
|
||||||
@ -714,6 +716,24 @@ public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
p.example = example;
|
p.example = example;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setParameterExampleValue(CodegenParameter codegenParameter, Parameter parameter) {
|
||||||
|
Schema schema = parameter.getSchema();
|
||||||
|
|
||||||
|
if (parameter.getExample() != null) {
|
||||||
|
codegenParameter.example = parameter.getExample().toString();
|
||||||
|
} else if (parameter.getExamples() != null && !parameter.getExamples().isEmpty()) {
|
||||||
|
Example example = parameter.getExamples().values().iterator().next();
|
||||||
|
if (example.getValue() != null) {
|
||||||
|
codegenParameter.example = example.getValue().toString();
|
||||||
|
}
|
||||||
|
} else if (schema != null && schema.getExample() != null) {
|
||||||
|
codegenParameter.example = schema.getExample().toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
setParameterExampleValue(codegenParameter);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String sanitizeTag(String tag) {
|
public String sanitizeTag(String tag) {
|
||||||
return sanitizeName(tag);
|
return sanitizeName(tag);
|
||||||
|
@ -78,7 +78,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -124,7 +124,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
|
@ -78,7 +78,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -124,7 +124,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
|
@ -78,7 +78,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -124,7 +124,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
body = NULL # list[User] | List of user object
|
body = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
|
@ -78,7 +78,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
user = NULL # list[User] | List of user object
|
user = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
@ -124,7 +124,7 @@ from pprint import pprint
|
|||||||
|
|
||||||
# create an instance of the API class
|
# create an instance of the API class
|
||||||
api_instance = petstore_api.UserApi()
|
api_instance = petstore_api.UserApi()
|
||||||
user = NULL # list[User] | List of user object
|
user = None # list[User] | List of user object
|
||||||
|
|
||||||
try:
|
try:
|
||||||
# Creates list of users with given input array
|
# Creates list of users with given input array
|
||||||
|
Loading…
Reference in New Issue
Block a user