forked from loafle/openapi-generator-original
added type tag
This commit is contained in:
parent
026c93a104
commit
8befb95986
@ -0,0 +1,34 @@
|
|||||||
|
package com.wordnik.swagger.codegen;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
|
public enum CodegenType {
|
||||||
|
CLIENT, SERVER, DOCUMENTATION, OTHER;
|
||||||
|
|
||||||
|
private static Map<String, CodegenType> names = new HashMap<String, CodegenType>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
names.put("client", CLIENT);
|
||||||
|
names.put("server", SERVER);
|
||||||
|
names.put("documentation", DOCUMENTATION);
|
||||||
|
names.put("other", OTHER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonCreator
|
||||||
|
public static CodegenType forValue(String value) {
|
||||||
|
return names.get(value.toLowerCase());
|
||||||
|
}
|
||||||
|
|
||||||
|
@JsonValue
|
||||||
|
public String toValue() {
|
||||||
|
for (Map.Entry<String, CodegenType> entry : names.entrySet()) {
|
||||||
|
if (entry.getValue() == this)
|
||||||
|
return entry.getKey();
|
||||||
|
}
|
||||||
|
|
||||||
|
return null; // or fail
|
||||||
|
}
|
||||||
|
}
|
@ -13,6 +13,10 @@ public class AndroidClientCodegen extends DefaultCodegen implements CodegenConfi
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "src/main/java";
|
protected String sourceFolder = "src/main/java";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "android";
|
return "android";
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ public class JavaClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "src/main/java";
|
protected String sourceFolder = "src/main/java";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "java";
|
return "java";
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ public class JaxRSServerCodegen extends JavaClientCodegen implements CodegenConf
|
|||||||
protected String sourceFolder = "src/main/java";
|
protected String sourceFolder = "src/main/java";
|
||||||
protected String title = "Swagger Server";
|
protected String title = "Swagger Server";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "jaxrs";
|
return "jaxrs";
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,10 @@ public class NodeJSServerCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
protected String artifactId = "swagger-client";
|
protected String artifactId = "swagger-client";
|
||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "nodejs";
|
return "nodejs";
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,10 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected String sourceFolder = "client";
|
protected String sourceFolder = "client";
|
||||||
protected static String PREFIX = "SWG";
|
protected static String PREFIX = "SWG";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "objc";
|
return "objc";
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,10 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected String groupId = "com.wordnik";
|
protected String groupId = "com.wordnik";
|
||||||
protected String artifactId = "swagger-client";
|
protected String artifactId = "swagger-client";
|
||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
// protected String sourceFolder = "";
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "php";
|
return "php";
|
||||||
|
@ -1,18 +1,3 @@
|
|||||||
/**
|
|
||||||
* Copyright 2014 Wordnik, Inc.
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
package com.wordnik.swagger.codegen.languages;
|
package com.wordnik.swagger.codegen.languages;
|
||||||
|
|
||||||
import com.wordnik.swagger.codegen.*;
|
import com.wordnik.swagger.codegen.*;
|
||||||
@ -23,6 +8,10 @@ import java.io.File;
|
|||||||
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
|
public class PythonClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||||
String module = "client";
|
String module = "client";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "python";
|
return "python";
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,10 @@ public class ScalaClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
protected boolean authPreemptive = false;
|
protected boolean authPreemptive = false;
|
||||||
protected boolean asyncHttpClient = !authScheme.isEmpty();
|
protected boolean asyncHttpClient = !authScheme.isEmpty();
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "scala";
|
return "scala";
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ public class ScalatraServerCodegen extends DefaultCodegen implements CodegenConf
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "src/main/scala";
|
protected String sourceFolder = "src/main/scala";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.SERVER;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "scalatra";
|
return "scalatra";
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ public class StaticDocCodegen extends DefaultCodegen implements CodegenConfig {
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "docs";
|
protected String sourceFolder = "docs";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.DOCUMENTATION;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "dynamic-html";
|
return "dynamic-html";
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,10 @@ public class StaticHtmlGenerator extends DefaultCodegen implements CodegenConfig
|
|||||||
protected String artifactVersion = "1.0.0";
|
protected String artifactVersion = "1.0.0";
|
||||||
protected String sourceFolder = "src/main/scala";
|
protected String sourceFolder = "src/main/scala";
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.DOCUMENTATION;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "html";
|
return "html";
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,10 @@ import org.apache.commons.io.FileUtils;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
|
||||||
public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
public class SwaggerGenerator extends DefaultCodegen implements CodegenConfig {
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.DOCUMENTATION;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "swagger";
|
return "swagger";
|
||||||
}
|
}
|
||||||
|
@ -13,6 +13,10 @@ public class TizenClientCodegen extends DefaultCodegen implements CodegenConfig
|
|||||||
protected static String PREFIX = "Sami";
|
protected static String PREFIX = "Sami";
|
||||||
protected Map<String, String> namespaces = new HashMap<String, String>();
|
protected Map<String, String> namespaces = new HashMap<String, String>();
|
||||||
|
|
||||||
|
public CodegenType getTag() {
|
||||||
|
return CodegenType.CLIENT;
|
||||||
|
}
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "tizen";
|
return "tizen";
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user