forked from loafle/openapi-generator-original
update getSchemaType variable, remove unused import (#365)
This commit is contained in:
parent
27b3302d8f
commit
db9a899a09
@ -189,15 +189,15 @@ public abstract class AbstractScalaCodegen extends DefaultCodegen {
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (typeMapping.containsKey(openAPIType)) {
|
||||
type = typeMapping.get(openAPIType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return toModelName(type);
|
||||
}
|
||||
} else {
|
||||
type = swaggerType;
|
||||
type = openAPIType;
|
||||
}
|
||||
return toModelName(type);
|
||||
}
|
||||
|
@ -151,7 +151,7 @@ public class BashClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
"Whether to generate the Zsh completion script"));
|
||||
cliOptions.add(CliOption.newString(HOST_ENVIRONMENT_VARIABLE_NAME,
|
||||
"Name of environment variable where host can be defined " +
|
||||
"(e.g. PETSTORE_HOST='http://petstore.swagger.io:8080')"));
|
||||
"(e.g. PETSTORE_HOST='http://api.openapitools.org:8080')"));
|
||||
cliOptions.add(CliOption.newString(BASIC_AUTH_ENVIRONMENT_VARIABLE_NAME,
|
||||
"Name of environment variable where username and password "
|
||||
+
|
||||
|
@ -186,21 +186,21 @@ public class JMeterCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
}
|
||||
|
||||
/**
|
||||
* Optional - swagger type conversion. This is used to map swagger types in a `Schema` into
|
||||
* Optional - OpenAPI type conversion. This is used to map OpenAPI types in a `Schema` into
|
||||
* either language specific types via `typeMapping` or into complex models if there is not a mapping.
|
||||
*
|
||||
* @return a string value of the type or complex model for this property
|
||||
*/
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (typeMapping.containsKey(openAPIType)) {
|
||||
type = typeMapping.get(openAPIType);
|
||||
if (languageSpecificPrimitives.contains(type))
|
||||
return toModelName(type);
|
||||
} else
|
||||
type = swaggerType;
|
||||
type = openAPIType;
|
||||
return toModelName(type);
|
||||
}
|
||||
|
||||
|
@ -54,10 +54,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String CORE_DATA = "coreData";
|
||||
|
||||
protected Set<String> foundationClasses = new HashSet<String>();
|
||||
protected String podName = "SwaggerClient";
|
||||
protected String podName = "OpenAPIClient";
|
||||
protected String podVersion = "1.0.0";
|
||||
protected String classPrefix = "SWG";
|
||||
protected String authorName = "Swagger";
|
||||
protected String authorName = "OpenAPI";
|
||||
protected String authorEmail = "team@openapitools.org";
|
||||
protected String license = DEFAULT_LICENSE;
|
||||
protected String gitRepoURL = "https://github.com/openapitools/openapi-generator";
|
||||
@ -191,10 +191,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
cliOptions.add(new CliOption(CLASS_PREFIX, "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`).`")
|
||||
.defaultValue("SWG"));
|
||||
cliOptions.add(new CliOption(POD_NAME, "cocoapods package name (convention: CameCase).")
|
||||
.defaultValue("SwaggerClient"));
|
||||
.defaultValue("OpenAPIClient"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "cocoapods package version.")
|
||||
.defaultValue("1.0.0"));
|
||||
cliOptions.add(new CliOption(AUTHOR_NAME, "Name to use in the podspec file.").defaultValue("Swagger"));
|
||||
cliOptions.add(new CliOption(AUTHOR_NAME, "Name to use in the podspec file.").defaultValue("OpenAPI"));
|
||||
cliOptions.add(new CliOption(AUTHOR_EMAIL, "Email to use in the podspec file.").defaultValue("team@openapitools.org"));
|
||||
cliOptions.add(new CliOption(GIT_REPO_URL, "URL for the git repo where this podspec should point to.")
|
||||
.defaultValue("https://github.com/openapitools/openapi-generator"));
|
||||
@ -329,21 +329,21 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
String type = null;
|
||||
|
||||
if (swaggerType == null) {
|
||||
swaggerType = ""; // set swagger type to empty string if null
|
||||
if (openAPIType == null) {
|
||||
openAPIType = ""; // set OpenAPI type to empty string if null
|
||||
}
|
||||
|
||||
// TODO avoid using toLowerCase as typeMapping should be case-sensitive
|
||||
if (typeMapping.containsKey(swaggerType.toLowerCase())) {
|
||||
type = typeMapping.get(swaggerType.toLowerCase());
|
||||
if (typeMapping.containsKey(openAPIType.toLowerCase())) {
|
||||
type = typeMapping.get(openAPIType.toLowerCase());
|
||||
if (languageSpecificPrimitives.contains(type) && !foundationClasses.contains(type)) {
|
||||
return toModelNameWithoutReservedWordCheck(type);
|
||||
}
|
||||
} else {
|
||||
type = swaggerType;
|
||||
type = openAPIType;
|
||||
}
|
||||
return toModelNameWithoutReservedWordCheck(type);
|
||||
}
|
||||
@ -391,22 +391,22 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return getSchemaType(p) + "<" + innerTypeDeclaration + ">*";
|
||||
}
|
||||
} else {
|
||||
String swaggerType = getSchemaType(p);
|
||||
String openAPIType = getSchemaType(p);
|
||||
// In this condition, type of p is objective-c primitive type, e.g. `NSSNumber',
|
||||
// return type of p with pointer, e.g. `NSNumber*'
|
||||
if (languageSpecificPrimitives.contains(swaggerType) &&
|
||||
foundationClasses.contains(swaggerType)) {
|
||||
return swaggerType + "*";
|
||||
if (languageSpecificPrimitives.contains(openAPIType) &&
|
||||
foundationClasses.contains(openAPIType)) {
|
||||
return openAPIType + "*";
|
||||
}
|
||||
// In this condition, type of p is c primitive type, e.g. `bool',
|
||||
// return type of p, e.g. `bool'
|
||||
else if (languageSpecificPrimitives.contains(swaggerType)) {
|
||||
return swaggerType;
|
||||
else if (languageSpecificPrimitives.contains(openAPIType)) {
|
||||
return openAPIType;
|
||||
}
|
||||
// In this condition, type of p is objective-c object type, e.g. `SWGPet',
|
||||
// return type of p with pointer, e.g. `SWGPet*'
|
||||
else {
|
||||
return swaggerType + "*";
|
||||
return openAPIType + "*";
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -658,7 +658,7 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
/**
|
||||
* Return the default value of the schema
|
||||
*
|
||||
* @param p Swagger schema object
|
||||
* @param p OpenAPI schema object
|
||||
* @return string presentation of the default value of the schema
|
||||
*/
|
||||
@Override
|
||||
|
@ -170,17 +170,17 @@ public class PhpSilexServerCodegen extends DefaultCodegen implements CodegenConf
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
String type = null;
|
||||
if (typeMapping.containsKey(swaggerType)) {
|
||||
type = typeMapping.get(swaggerType);
|
||||
if (typeMapping.containsKey(openAPIType)) {
|
||||
type = typeMapping.get(openAPIType);
|
||||
if (languageSpecificPrimitives.contains(type)) {
|
||||
return type;
|
||||
} else if (instantiationTypes.containsKey(type)) {
|
||||
return type;
|
||||
}
|
||||
} else {
|
||||
type = swaggerType;
|
||||
type = openAPIType;
|
||||
}
|
||||
if (type == null) {
|
||||
return null;
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.languages;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.google.common.collect.ArrayListMultimap;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Multimap;
|
||||
@ -28,8 +27,6 @@ import io.swagger.v3.oas.models.media.*;
|
||||
import io.swagger.v3.oas.models.PathItem;
|
||||
import io.swagger.v3.oas.models.PathItem.HttpMethod;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.parameters.*;
|
||||
import io.swagger.v3.core.util.Yaml;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.*;
|
||||
|
@ -30,9 +30,6 @@ import java.util.Set;
|
||||
import io.swagger.v3.parser.util.SchemaTypeUtil;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.features.BeanValidationFeatures;
|
||||
import org.openapitools.codegen.languages.features.JbossFeature;
|
||||
import org.openapitools.codegen.languages.features.SwaggerFeatures;
|
||||
import io.swagger.v3.oas.models.*;
|
||||
import io.swagger.v3.oas.models.media.*;
|
||||
|
||||
@ -181,12 +178,12 @@ public class TypeScriptInversifyClientCodegen extends AbstractTypeScriptClientCo
|
||||
|
||||
@Override
|
||||
public String getSchemaType(Schema p) {
|
||||
String swaggerType = super.getSchemaType(p);
|
||||
if (isLanguagePrimitive(swaggerType) || isLanguageGenericType(swaggerType)) {
|
||||
return swaggerType;
|
||||
String openAPIType = super.getSchemaType(p);
|
||||
if (isLanguagePrimitive(openAPIType) || isLanguageGenericType(openAPIType)) {
|
||||
return openAPIType;
|
||||
}
|
||||
applyLocalTypeMapping(swaggerType);
|
||||
return swaggerType;
|
||||
applyLocalTypeMapping(openAPIType);
|
||||
return openAPIType;
|
||||
}
|
||||
|
||||
private String applyLocalTypeMapping(String type) {
|
||||
|
@ -17,7 +17,6 @@
|
||||
|
||||
package org.openapitools.codegen.ruby;
|
||||
|
||||
import io.swagger.models.parameters.FormParameter;
|
||||
import io.swagger.v3.oas.models.Operation;
|
||||
import org.openapitools.codegen.*;
|
||||
import org.openapitools.codegen.languages.RubyClientCodegen;
|
||||
|
Loading…
x
Reference in New Issue
Block a user