forked from loafle/openapi-generator-original
Merge branch 'master' of https://github.com/swagger-api/swagger-codegen
This commit is contained in:
51
README.md
51
README.md
@@ -32,12 +32,14 @@ Check out [Swagger-Spec](https://github.com/swagger-api/swagger-spec) for additi
|
||||
- [Generating dynamic html api documentation](#generating-dynamic-html-api-documentation)
|
||||
- [Generating static html api documentation](#generating-static-html-api-documentation)
|
||||
- [To build a server stub](#to-build-a-server-stub)
|
||||
- [node.js](#nodejs)
|
||||
- [rails-grape](#rails-grape)
|
||||
- [scala scalatra](#scala-scalatra)
|
||||
- [java jax-rs](#java-jax-rs)
|
||||
- [java spring-mvc](#java-spring-mvc)
|
||||
- [Node.js](#nodejs)
|
||||
- [PHP Silex](#php-silex)
|
||||
- [Ruby Sinatra](#ruby-sinatra)
|
||||
- [Scala Scalatra](#scala-scalatra)
|
||||
- [Java JAX-RS](#java-jax-rs)
|
||||
- [Java Spring MVC](#java-spring-mvc)
|
||||
- [To build the codegen library](#to-build-the-codegen-library)
|
||||
- [Online Generators](#online-generators)
|
||||
- [License](#license)
|
||||
|
||||
## Build and run using docker
|
||||
@@ -190,7 +192,7 @@ You can look at `modules/swagger-codegen/src/main/resources/${your-language}` fo
|
||||
If you're starting a project with a new language and don't see what you need, swagger-codegen can help you create a project to generate your own libraries:
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-distribution/target/swagger-codegen-cli.jar meta \
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar meta \
|
||||
-o output/myLibrary -n myClientCodegen -p com.my.company.codegen
|
||||
```
|
||||
|
||||
@@ -406,7 +408,7 @@ open index.html
|
||||
|
||||
You can also use the codegen to generate a server for a couple different frameworks. Take a look here:
|
||||
|
||||
### node.js
|
||||
### Node.js
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
@@ -415,11 +417,25 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-o samples/server/petstore/nodejs
|
||||
```
|
||||
|
||||
### rails-grape
|
||||
### PHP Silex
|
||||
|
||||
*Not yet migrated to this branch*
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l silex \
|
||||
-o samples/server/petstore/silex
|
||||
```
|
||||
|
||||
### scala scalatra
|
||||
### Ruby Sinatra
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
-l sinatra \
|
||||
-o samples/server/petstore/sinatra
|
||||
```
|
||||
|
||||
### Scala Scalatra
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-i http://petstore.swagger.io/v2/swagger.json \
|
||||
@@ -427,7 +443,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-o samples/server/petstore/scalatra
|
||||
```
|
||||
|
||||
### java jax-rs
|
||||
### Java JAX-RS
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
@@ -436,7 +452,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-o samples/server/petstore/jaxrs
|
||||
```
|
||||
|
||||
### java spring-mvc
|
||||
### Java Spring MVC
|
||||
|
||||
```
|
||||
java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
@@ -444,6 +460,7 @@ java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate \
|
||||
-l spring-mvc \
|
||||
-o samples/server/petstore/spring-mvc
|
||||
```
|
||||
|
||||
### To build the codegen library
|
||||
|
||||
This will create the swagger-codegen library from source.
|
||||
@@ -454,6 +471,16 @@ mvn package
|
||||
|
||||
Note! The templates are included in the library generated. If you want to modify the templates, you'll need to either repackage the library OR specify a path to your scripts
|
||||
|
||||
## Online generators
|
||||
|
||||
One can also generate API client or sever using the online generators (https://generator.swagger.io)
|
||||
|
||||
For example, to generate Ruby API client, simply send the following HTTP request using curl:
|
||||
```
|
||||
curl -X POST -H "content-type:application/json" -d '{"swaggerUrl":"http://petstore.swagger.io/v2/swagger.json"}' https://generator.swagger.io/api/gen/clients/ruby
|
||||
```
|
||||
Then you will receieve a JSON response with the URL to download the zipped code.
|
||||
|
||||
License
|
||||
-------
|
||||
|
||||
|
||||
@@ -103,6 +103,18 @@
|
||||
<artifactId>maven-release-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<profiles>
|
||||
|
||||
@@ -42,4 +42,5 @@ public class CodegenConstants {
|
||||
|
||||
public static final String PACKAGE_NAME = "packageName";
|
||||
public static final String PACKAGE_VERSION = "packageVersion";
|
||||
public static final String POD_VERSION = "podVersion";
|
||||
}
|
||||
|
||||
@@ -12,7 +12,8 @@ public class CodegenOperation {
|
||||
public final List<CodegenProperty> responseHeaders = new ArrayList<CodegenProperty>();
|
||||
public Boolean hasAuthMethods, hasConsumes, hasProduces, hasParams, returnTypeIsPrimitive,
|
||||
returnSimpleType, subresourceOperation, isMapContainer, isListContainer,
|
||||
hasMore = Boolean.TRUE, isMultipart, isResponseBinary = Boolean.FALSE;
|
||||
hasMore = Boolean.TRUE, isMultipart, isResponseBinary = Boolean.FALSE,
|
||||
hasReference = Boolean.FALSE;
|
||||
public String path, operationId, returnType, httpMethod, returnBaseType,
|
||||
returnContainer, summary, notes, baseName, defaultResponse;
|
||||
public List<Map<String, String>> consumes, produces;
|
||||
|
||||
@@ -1201,6 +1201,7 @@ public class DefaultCodegen {
|
||||
op.examples = new ExampleGenerator(definitions).generate(methodResponse.getExamples(), operation.getProduces(), responseProperty);
|
||||
op.defaultResponse = toDefaultValue(responseProperty);
|
||||
op.returnType = cm.datatype;
|
||||
op.hasReference = definitions != null && definitions.containsKey(op.returnBaseType);
|
||||
if (cm.isContainer != null) {
|
||||
op.returnContainer = cm.containerType;
|
||||
if ("map".equals(cm.containerType)) {
|
||||
|
||||
@@ -2,6 +2,7 @@ package io.swagger.codegen.languages;
|
||||
|
||||
import io.swagger.codegen.CliOption;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.CodegenType;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
@@ -19,6 +20,12 @@ import java.util.Set;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String CLASS_PREFIX = "classPrefix";
|
||||
public static final String POD_NAME = "podName";
|
||||
public static final String AUTHOR_NAME = "authorName";
|
||||
public static final String AUTHOR_EMAIL = "authorEmail";
|
||||
public static final String GIT_REPO_URL = "gitRepoURL";
|
||||
public static final String LICENSE = "license";
|
||||
protected Set<String> foundationClasses = new HashSet<String>();
|
||||
protected String podName = "SwaggerClient";
|
||||
protected String podVersion = "1.0.0";
|
||||
@@ -113,13 +120,13 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
instantiationTypes.put("map", "NSMutableDictionary");
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption("classPrefix", "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`"));
|
||||
cliOptions.add(new CliOption("podName", "cocoapods package name (convention: CameCase), default: `SwaggerClient`"));
|
||||
cliOptions.add(new CliOption("podVersion", "cocoapods package version, default: `1.0.0`"));
|
||||
cliOptions.add(new CliOption("authorName", "Name to use in the podspec file, default: `Swagger`"));
|
||||
cliOptions.add(new CliOption("authorEmail", "Email to use in the podspec file, default: `apiteam@swagger.io`"));
|
||||
cliOptions.add(new CliOption("gitRepoURL", "URL for the git repo where this podspec should point to, default: `https://github.com/swagger-api/swagger-codegen`"));
|
||||
cliOptions.add(new CliOption("license", "License to use in the podspec file, default: `MIT`"));
|
||||
cliOptions.add(new CliOption(CLASS_PREFIX, "prefix for generated classes (convention: Abbreviation of pod name e.g. `HN` for `HackerNews`), default: `SWG`"));
|
||||
cliOptions.add(new CliOption(POD_NAME, "cocoapods package name (convention: CameCase), default: `SwaggerClient`"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "cocoapods package version, default: `1.0.0`"));
|
||||
cliOptions.add(new CliOption(AUTHOR_NAME, "Name to use in the podspec file, default: `Swagger`"));
|
||||
cliOptions.add(new CliOption(AUTHOR_EMAIL, "Email to use in the podspec file, default: `apiteam@swagger.io`"));
|
||||
cliOptions.add(new CliOption(GIT_REPO_URL, "URL for the git repo where this podspec should point to, default: `https://github.com/swagger-api/swagger-codegen`"));
|
||||
cliOptions.add(new CliOption(LICENSE, "License to use in the podspec file, default: `MIT`"));
|
||||
}
|
||||
|
||||
public CodegenType getTag() {
|
||||
@@ -138,41 +145,41 @@ public class ObjcClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey("podName")) {
|
||||
setPodName((String) additionalProperties.get("podName"));
|
||||
if (additionalProperties.containsKey(POD_NAME)) {
|
||||
setPodName((String) additionalProperties.get(POD_NAME));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("podVersion")) {
|
||||
setPodVersion((String) additionalProperties.get("podVersion"));
|
||||
if (additionalProperties.containsKey(CodegenConstants.POD_VERSION)) {
|
||||
setPodVersion((String) additionalProperties.get(CodegenConstants.POD_VERSION));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("classPrefix")) {
|
||||
setClassPrefix((String) additionalProperties.get("classPrefix"));
|
||||
if (additionalProperties.containsKey(CLASS_PREFIX)) {
|
||||
setClassPrefix((String) additionalProperties.get(CLASS_PREFIX));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("authorName")) {
|
||||
setAuthorName((String) additionalProperties.get("authorName"));
|
||||
if (additionalProperties.containsKey(AUTHOR_NAME)) {
|
||||
setAuthorName((String) additionalProperties.get(AUTHOR_NAME));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("authorEmail")) {
|
||||
setAuthorEmail((String) additionalProperties.get("authorEmail"));
|
||||
if (additionalProperties.containsKey(AUTHOR_EMAIL)) {
|
||||
setAuthorEmail((String) additionalProperties.get(AUTHOR_EMAIL));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("gitRepoURL")) {
|
||||
setGitRepoURL((String) additionalProperties.get("gitRepoURL"));
|
||||
if (additionalProperties.containsKey(GIT_REPO_URL)) {
|
||||
setGitRepoURL((String) additionalProperties.get(GIT_REPO_URL));
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("license")) {
|
||||
setLicense((String) additionalProperties.get("license"));
|
||||
if (additionalProperties.containsKey(LICENSE)) {
|
||||
setLicense((String) additionalProperties.get(LICENSE));
|
||||
}
|
||||
|
||||
additionalProperties.put("podName", podName);
|
||||
additionalProperties.put("podVersion", podVersion);
|
||||
additionalProperties.put("classPrefix", classPrefix);
|
||||
additionalProperties.put("authorName", authorName);
|
||||
additionalProperties.put("authorEmail", authorEmail);
|
||||
additionalProperties.put("gitRepoURL", gitRepoURL);
|
||||
additionalProperties.put("license", license);
|
||||
additionalProperties.put(POD_NAME, podName);
|
||||
additionalProperties.put(CodegenConstants.POD_VERSION, podVersion);
|
||||
additionalProperties.put(CLASS_PREFIX, classPrefix);
|
||||
additionalProperties.put(AUTHOR_NAME, authorName);
|
||||
additionalProperties.put(AUTHOR_EMAIL, authorEmail);
|
||||
additionalProperties.put(GIT_REPO_URL, gitRepoURL);
|
||||
additionalProperties.put(LICENSE, license);
|
||||
|
||||
String swaggerFolder = podName;
|
||||
|
||||
|
||||
@@ -16,6 +16,8 @@ import java.util.HashSet;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
|
||||
public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public static final String MODULE_NAME = "moduleName";
|
||||
public static final String MODULE_VERSION = "moduleVersion";
|
||||
protected String moduleName = "SwaggerClient";
|
||||
protected String moduleVersion = "1.0.0";
|
||||
|
||||
@@ -68,8 +70,8 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
typeMapping.put("object", "object");
|
||||
|
||||
cliOptions.clear();
|
||||
cliOptions.add(new CliOption("moduleName", "perl module name (convention: CamelCase), default: SwaggerClient"));
|
||||
cliOptions.add(new CliOption("moduleVersion", "perl module version, default: 1.0.0"));
|
||||
cliOptions.add(new CliOption(MODULE_NAME, "perl module name (convention: CamelCase), default: SwaggerClient"));
|
||||
cliOptions.add(new CliOption(MODULE_VERSION, "perl module version, default: 1.0.0"));
|
||||
}
|
||||
|
||||
|
||||
@@ -77,16 +79,16 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey("moduleVersion")) {
|
||||
moduleVersion = (String) additionalProperties.get("moduleVersion");
|
||||
if (additionalProperties.containsKey(MODULE_VERSION)) {
|
||||
setModuleVersion((String) additionalProperties.get(MODULE_VERSION));
|
||||
} else {
|
||||
additionalProperties.put("moduleVersion", moduleVersion);
|
||||
additionalProperties.put(MODULE_VERSION, moduleVersion);
|
||||
}
|
||||
|
||||
if (additionalProperties.containsKey("moduleName")) {
|
||||
moduleName = (String) additionalProperties.get("moduleName");
|
||||
if (additionalProperties.containsKey(MODULE_NAME)) {
|
||||
setModuleName((String) additionalProperties.get(MODULE_NAME));
|
||||
} else {
|
||||
additionalProperties.put("moduleName", moduleName);
|
||||
additionalProperties.put(MODULE_NAME, moduleName);
|
||||
}
|
||||
|
||||
supportingFiles.add(new SupportingFile("ApiClient.mustache", ("lib/WWW/" + moduleName).replace('/', File.separatorChar), "ApiClient.pm"));
|
||||
@@ -229,5 +231,11 @@ public class PerlClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
return underscore(operationId);
|
||||
}
|
||||
|
||||
public void setModuleName(String moduleName) {
|
||||
this.moduleName = moduleName;
|
||||
}
|
||||
|
||||
public void setModuleVersion(String moduleVersion) {
|
||||
this.moduleVersion = moduleVersion;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -334,6 +334,9 @@ public class PhpClientCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
// Note: backslash ("\\") is allowed for e.g. "\\DateTime"
|
||||
name = name.replaceAll("[^\\w\\\\]+", "_");
|
||||
|
||||
// remove dollar sign
|
||||
name = name.replaceAll("$", "");
|
||||
|
||||
// model name cannot use reserved keyword
|
||||
if (reservedWords.contains(name)) {
|
||||
escapeReservedWord(name); // e.g. return => _return
|
||||
|
||||
@@ -97,7 +97,9 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
Arrays.asList(
|
||||
"bool",
|
||||
"qint32",
|
||||
"qint64")
|
||||
"qint64",
|
||||
"float",
|
||||
"double")
|
||||
);
|
||||
|
||||
supportingFiles.add(new SupportingFile("helpers-header.mustache", sourceFolder, PREFIX + "Helpers.h"));
|
||||
@@ -321,4 +323,4 @@ public class Qt5CPPGenerator extends DefaultCodegen implements CodegenConfig {
|
||||
public String toApiName(String type) {
|
||||
return PREFIX + Character.toUpperCase(type.charAt(0)) + type.substring(1) + "Api";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import java.util.Map;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class SpringMVCServerCodegen extends JavaClientCodegen implements CodegenConfig {
|
||||
public static final String CONFIG_PACKAGE = "configPackage";
|
||||
protected String title = "Petstore Server";
|
||||
protected String configPackage = "";
|
||||
|
||||
@@ -36,7 +37,7 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
|
||||
additionalProperties.put(CodegenConstants.ARTIFACT_VERSION, artifactVersion);
|
||||
additionalProperties.put("title", title);
|
||||
additionalProperties.put(CodegenConstants.API_PACKAGE, apiPackage);
|
||||
additionalProperties.put("configPackage", configPackage);
|
||||
additionalProperties.put(CONFIG_PACKAGE, configPackage);
|
||||
|
||||
languageSpecificPrimitives = new HashSet<String>(
|
||||
Arrays.asList(
|
||||
@@ -49,8 +50,7 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
|
||||
"Float")
|
||||
);
|
||||
|
||||
cliOptions.add(new CliOption("configPackage", "configuration package for generated code"));
|
||||
|
||||
cliOptions.add(new CliOption(CONFIG_PACKAGE, "configuration package for generated code"));
|
||||
}
|
||||
|
||||
public CodegenType getTag() {
|
||||
@@ -69,8 +69,8 @@ public class SpringMVCServerCodegen extends JavaClientCodegen implements Codegen
|
||||
public void processOpts() {
|
||||
super.processOpts();
|
||||
|
||||
if (additionalProperties.containsKey("configPackage")) {
|
||||
this.setConfigPackage((String) additionalProperties.get("configPackage"));
|
||||
if (additionalProperties.containsKey(CONFIG_PACKAGE)) {
|
||||
this.setConfigPackage((String) additionalProperties.get(CONFIG_PACKAGE));
|
||||
}
|
||||
|
||||
supportingFiles.clear();
|
||||
|
||||
@@ -24,13 +24,26 @@ import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
private static final Pattern PATH_PARAM_PATTERN = Pattern.compile("\\{[a-zA-Z_]+\\}");
|
||||
public static final String PROJECT_NAME = "projectName";
|
||||
public static final String RESPONSE_AS = "responseAs";
|
||||
public static final String UNWRAP_REQUIRED = "unwrapRequired";
|
||||
public static final String POD_SOURCE = "podSource";
|
||||
public static final String POD_AUTHORS = "podAuthors";
|
||||
public static final String POD_SOCIAL_MEDIA_URL = "podSocialMediaURL";
|
||||
public static final String POD_DOCSET_URL = "podDocsetURL";
|
||||
public static final String POD_LICENSE = "podLicense";
|
||||
public static final String POD_HOMEPAGE = "podHomepage";
|
||||
public static final String POD_SUMMARY = "podSummary";
|
||||
public static final String POD_DESCRIPTION = "podDescription";
|
||||
public static final String POD_SCREENSHOTS = "podScreenshots";
|
||||
public static final String POD_DOCUMENTATION_URL = "podDocumentationURL";
|
||||
protected static final String LIBRARY_PROMISE_KIT = "PromiseKit";
|
||||
protected static final String[] RESPONSE_LIBRARIES = { LIBRARY_PROMISE_KIT };
|
||||
protected String projectName = "SwaggerClient";
|
||||
protected boolean unwrapRequired = false;
|
||||
protected String[] responseAs = new String[0];
|
||||
protected String sourceFolder = "Classes" + File.separator + "Swaggers";
|
||||
private static final Pattern PATH_PARAM_PATTERN = Pattern.compile("\\{[a-zA-Z_]+\\}");
|
||||
|
||||
public CodegenType getTag() {
|
||||
return CodegenType.CLIENT;
|
||||
@@ -107,22 +120,22 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
importMapping = new HashMap<String, String>();
|
||||
|
||||
cliOptions.add(new CliOption("projectName", "Project name in Xcode"));
|
||||
cliOptions.add(new CliOption("responseAs", "Optionally use libraries to manage response. Currently " +
|
||||
cliOptions.add(new CliOption(PROJECT_NAME, "Project name in Xcode"));
|
||||
cliOptions.add(new CliOption(RESPONSE_AS, "Optionally use libraries to manage response. Currently " +
|
||||
StringUtils.join(RESPONSE_LIBRARIES, ", ") + " are available."));
|
||||
cliOptions.add(new CliOption("unwrapRequired", "Treat 'required' properties in response as non-optional " +
|
||||
cliOptions.add(new CliOption(UNWRAP_REQUIRED, "Treat 'required' properties in response as non-optional " +
|
||||
"(which would crash the app if api returns null as opposed to required option specified in json schema"));
|
||||
cliOptions.add(new CliOption("podSource", "Source information used for Podspec"));
|
||||
cliOptions.add(new CliOption("podVersion", "Version used for Podspec"));
|
||||
cliOptions.add(new CliOption("podAuthors", "Authors used for Podspec"));
|
||||
cliOptions.add(new CliOption("podSocialMediaURL", "Social Media URL used for Podspec"));
|
||||
cliOptions.add(new CliOption("podDocsetURL", "Docset URL used for Podspec"));
|
||||
cliOptions.add(new CliOption("podLicense", "License used for Podspec"));
|
||||
cliOptions.add(new CliOption("podHomepage", "Homepage used for Podspec"));
|
||||
cliOptions.add(new CliOption("podSummary", "Summary used for Podspec"));
|
||||
cliOptions.add(new CliOption("podDescription", "Description used for Podspec"));
|
||||
cliOptions.add(new CliOption("podScreenshots", "Screenshots used for Podspec"));
|
||||
cliOptions.add(new CliOption("podDocumentationURL", "Documentation URL used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_SOURCE, "Source information used for Podspec"));
|
||||
cliOptions.add(new CliOption(CodegenConstants.POD_VERSION, "Version used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_AUTHORS, "Authors used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_SOCIAL_MEDIA_URL, "Social Media URL used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_DOCSET_URL, "Docset URL used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_LICENSE, "License used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_HOMEPAGE, "Homepage used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_SUMMARY, "Summary used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_DESCRIPTION, "Description used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_SCREENSHOTS, "Screenshots used for Podspec"));
|
||||
cliOptions.add(new CliOption(POD_DOCUMENTATION_URL, "Documentation URL used for Podspec"));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -130,29 +143,29 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
super.processOpts();
|
||||
|
||||
// Setup project name
|
||||
if (additionalProperties.containsKey("projectName")) {
|
||||
projectName = (String) additionalProperties.get("projectName");
|
||||
if (additionalProperties.containsKey(PROJECT_NAME)) {
|
||||
setProjectName((String) additionalProperties.get(PROJECT_NAME));
|
||||
} else {
|
||||
additionalProperties.put("projectName", projectName);
|
||||
additionalProperties.put(PROJECT_NAME, projectName);
|
||||
}
|
||||
sourceFolder = projectName + File.separator + sourceFolder;
|
||||
|
||||
// Setup unwrapRequired option, which makes all the properties with "required" non-optional
|
||||
if (additionalProperties.containsKey("unwrapRequired")) {
|
||||
unwrapRequired = Boolean.parseBoolean(String.valueOf(additionalProperties.get("unwrapRequired")));
|
||||
if (additionalProperties.containsKey(UNWRAP_REQUIRED)) {
|
||||
setUnwrapRequired(Boolean.parseBoolean(String.valueOf(additionalProperties.get(UNWRAP_REQUIRED))));
|
||||
}
|
||||
additionalProperties.put("unwrapRequired", unwrapRequired);
|
||||
additionalProperties.put(UNWRAP_REQUIRED, unwrapRequired);
|
||||
|
||||
// Setup unwrapRequired option, which makes all the properties with "required" non-optional
|
||||
if (additionalProperties.containsKey("responseAs")) {
|
||||
Object responseAsObject = additionalProperties.get("responseAs");
|
||||
if (additionalProperties.containsKey(RESPONSE_AS)) {
|
||||
Object responseAsObject = additionalProperties.get(RESPONSE_AS);
|
||||
if (responseAsObject instanceof String) {
|
||||
responseAs = ((String)responseAsObject).split(",");
|
||||
setResponseAs(((String)responseAsObject).split(","));
|
||||
} else {
|
||||
responseAs = (String[]) responseAsObject;
|
||||
setResponseAs((String[]) responseAsObject);
|
||||
}
|
||||
}
|
||||
additionalProperties.put("responseAs", responseAs);
|
||||
additionalProperties.put(RESPONSE_AS, responseAs);
|
||||
if (ArrayUtils.contains(responseAs, LIBRARY_PROMISE_KIT)) {
|
||||
additionalProperties.put("usePromiseKit", true);
|
||||
}
|
||||
@@ -308,4 +321,16 @@ public class SwiftCodegen extends DefaultCodegen implements CodegenConfig {
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public void setProjectName(String projectName) {
|
||||
this.projectName = projectName;
|
||||
}
|
||||
|
||||
public void setUnwrapRequired(boolean unwrapRequired) {
|
||||
this.unwrapRequired = unwrapRequired;
|
||||
}
|
||||
|
||||
public void setResponseAs(String[] responseAs) {
|
||||
this.responseAs = responseAs;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ import {{invokerPackage}}.auth.OAuth;
|
||||
|
||||
{{>generatedAnnotation}}
|
||||
public class ApiClient {
|
||||
private Client client;
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
private boolean debugging = false;
|
||||
@@ -69,6 +70,8 @@ public class ApiClient {
|
||||
// Set default User-Agent.
|
||||
setUserAgent("Java-Swagger");
|
||||
|
||||
buildClient();
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<String, Authentication>();{{#authMethods}}{{#isBasic}}
|
||||
authentications.put("{{name}}", new HttpBasicAuth());{{/isBasic}}{{#isApiKey}}
|
||||
@@ -203,6 +206,7 @@ public class ApiClient {
|
||||
*/
|
||||
public ApiClient setDebugging(boolean debugging) {
|
||||
this.debugging = debugging;
|
||||
buildClient();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -419,13 +423,6 @@ public class ApiClient {
|
||||
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, TypeRef returnType) throws ApiException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||
|
||||
final ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.register(MultiPartFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
}
|
||||
Client client = ClientBuilder.newClient(clientConfig);
|
||||
|
||||
WebTarget target = client.target(this.basePath).path(path);
|
||||
|
||||
if (queryParams != null) {
|
||||
@@ -537,6 +534,15 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
private void buildClient() {
|
||||
final ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.register(MultiPartFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
}
|
||||
this.client = ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
||||
private Map<String, List<String>> buildResponseHeaders(Response response) {
|
||||
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
||||
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
||||
|
||||
@@ -94,17 +94,15 @@
|
||||
</div> <!-- field-items -->
|
||||
{{/hasFormParams}}
|
||||
|
||||
<!-- Remove Return type... unclear where this comes from;
|
||||
for our swagger.json files, it is always empty and there is no boolean guard or hasReturnType
|
||||
do we end up with a heading but not content
|
||||
|
||||
{{#returnType}}
|
||||
<h3 class="field-label">Return type</h3>
|
||||
<div class="return-type"><a href="#{{returnContainer}}">{{{returnType}}}</a></div>
|
||||
<div class="return-type">
|
||||
{{#hasReference}}{{^returnSimpleType}}{{returnContainer}}[{{/returnSimpleType}}<a href="#{{returnBaseType}}">{{returnBaseType}}</a>{{^returnSimpleType}}]{{/returnSimpleType}}{{/hasReference}}
|
||||
{{^hasReference}}{{returnType}}{{/hasReference}}
|
||||
</div>
|
||||
{{/returnType}}
|
||||
|
||||
Todo: process Response Object and its headers, schema, examples
|
||||
-->
|
||||
<!--Todo: process Response Object and its headers, schema, examples -->
|
||||
|
||||
{{#hasExamples}}
|
||||
{{#examples}}
|
||||
|
||||
@@ -36,28 +36,30 @@ sub TO_JSON {
|
||||
return $_data;
|
||||
}
|
||||
|
||||
# from json string
|
||||
# from Perl hashref
|
||||
sub from_hash {
|
||||
my ($self, $hash) = @_;
|
||||
|
||||
# loop through attributes and use swagger_types to deserialize the data
|
||||
while ( my ($_key, $_type) = each %{$self->get_swagger_types} ) {
|
||||
my $_json_attribute = $self->get_attribute_map->{$_key};
|
||||
if ($_type =~ /^array\[/i) { # array
|
||||
my $_subclass = substr($_type, 6, -1);
|
||||
my @_array = ();
|
||||
foreach my $_element (@{$hash->{$self->get_attribute_map->{$_key}}}) {
|
||||
foreach my $_element (@{$hash->{$_json_attribute}}) {
|
||||
push @_array, $self->_deserialize($_subclass, $_element);
|
||||
}
|
||||
$self->{$_key} = \@_array;
|
||||
} elsif (defined $hash->{$_key}) { #hash(model), primitive, datetime
|
||||
$self->{$_key} = $self->_deserialize($_type, $hash->{$_key});
|
||||
} elsif (exists $hash->{$_json_attribute}) { #hash(model), primitive, datetime
|
||||
$self->{$_key} = $self->_deserialize($_type, $hash->{$_json_attribute});
|
||||
} else {
|
||||
$log->debugf("warning: %s not defined\n", $_key);
|
||||
$log->debugf("Warning: %s (%s) does not exist in input hash\n", $_key, $_json_attribute);
|
||||
}
|
||||
}
|
||||
|
||||
return $self;
|
||||
}
|
||||
|
||||
|
||||
# deserialize non-array data
|
||||
sub _deserialize {
|
||||
my ($self, $type, $data) = @_;
|
||||
|
||||
@@ -69,7 +69,7 @@ class ApiClient
|
||||
* Constructor of the class
|
||||
* @param Configuration $config config for this ApiClient
|
||||
*/
|
||||
function __construct(Configuration $config = null)
|
||||
public function __construct(Configuration $config = null)
|
||||
{
|
||||
if ($config == null) {
|
||||
$config = Configuration::getDefaultConfiguration();
|
||||
|
||||
@@ -170,8 +170,8 @@ use \{{invokerPackage}}\ObjectSerializer;
|
||||
if (isset($apiKey)) {
|
||||
{{#isKeyInHeader}}$headerParams['{{keyParamName}}'] = $apiKey;{{/isKeyInHeader}}{{#isKeyInQuery}}$queryParams['{{keyParamName}}'] = $apiKey;{{/isKeyInQuery}}
|
||||
}{{/isApiKey}}
|
||||
{{#isBasic}}$headerParams['Authorization'] = 'Basic '.base64_encode($this->apiClient->getConfig()->getUsername().":".$this->apiClient->getConfig()->getPassword());{{/isBasic}}
|
||||
{{#isOAuth}}//TODO support oauth{{/isOAuth}}
|
||||
{{#isBasic}}$headerParams['Authorization'] = 'Basic ' . base64_encode($this->apiClient->getConfig()->getUsername() . ":" . $this->apiClient->getConfig()->getPassword());{{/isBasic}}
|
||||
{{#isOAuth}}$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();{{/isOAuth}}
|
||||
{{/authMethods}}
|
||||
// make the API Call
|
||||
try
|
||||
|
||||
@@ -63,6 +63,13 @@ class Configuration
|
||||
*/
|
||||
protected $apiKeyPrefixes = array();
|
||||
|
||||
/**
|
||||
* Access token for OAuth
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $accessToken = '';
|
||||
|
||||
/**
|
||||
* Username for HTTP basic authentication
|
||||
*
|
||||
@@ -195,6 +202,29 @@ class Configuration
|
||||
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the access token for OAuth
|
||||
*
|
||||
* @param string $accessToken Token for OAuth
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public function setAccessToken($accessToken)
|
||||
{
|
||||
$this->$accessToken = $accessToken;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the access token for OAuth
|
||||
*
|
||||
* @return string Access token for OAuth
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
return $this->accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username for HTTP basic authentication
|
||||
*
|
||||
|
||||
@@ -25,6 +25,14 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
qint64 *val = static_cast<qint64*>(value);
|
||||
*val = obj.toVariant().toLongLong();
|
||||
}
|
||||
else if(QStringLiteral("float").compare(type) == 0) {
|
||||
float *val = static_cast<float*>(value);
|
||||
*val = obj.toDouble();
|
||||
}
|
||||
else if(QStringLiteral("double").compare(type) == 0) {
|
||||
double *val = static_cast<double*>(value);
|
||||
*val = obj.toDouble();
|
||||
}
|
||||
else if (QStringLiteral("QString").compare(type) == 0) {
|
||||
QString **val = static_cast<QString**>(value);
|
||||
|
||||
@@ -86,6 +94,16 @@ setValue(void* value, QJsonValue obj, QString type, QString complexType) {
|
||||
setValue(&val, jval, QStringLiteral("bool"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
}
|
||||
else if(QStringLiteral("float").compare(complexType) == 0) {
|
||||
float val;
|
||||
setValue(&val, jval, QStringLiteral("float"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
}
|
||||
else if(QStringLiteral("double").compare(complexType) == 0) {
|
||||
double val;
|
||||
setValue(&val, jval, QStringLiteral("double"), QStringLiteral(""));
|
||||
output->append((void*)&val);
|
||||
}
|
||||
}
|
||||
}
|
||||
QList<void*> **val = static_cast<QList<void*>**>(value);
|
||||
@@ -131,6 +149,14 @@ toJsonValue(QString name, void* value, QJsonObject* output, QString type) {
|
||||
bool* str = static_cast<bool*>(value);
|
||||
output->insert(name, QJsonValue(*str));
|
||||
}
|
||||
else if(QStringLiteral("float").compare(type) == 0) {
|
||||
float* str = static_cast<float*>(value);
|
||||
output->insert(name, QJsonValue((double)*str));
|
||||
}
|
||||
else if(QStringLiteral("double").compare(type) == 0) {
|
||||
double* str = static_cast<double*>(value);
|
||||
output->insert(name, QJsonValue(*str));
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
package io.swagger.codegen;
|
||||
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
|
||||
import com.google.common.base.Function;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import mockit.FullVerifications;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
public abstract class AbstractOptionsTest {
|
||||
private final OptionsProvider optionsProvider;
|
||||
|
||||
protected AbstractOptionsTest(OptionsProvider optionsProvider) {
|
||||
this.optionsProvider = optionsProvider;
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkOptionsProcessing() {
|
||||
getCodegenConfig().additionalProperties().putAll(getAvaliableOptions());
|
||||
getCodegenConfig().additionalProperties().putAll(optionsProvider.createOptions());
|
||||
setExpectations();
|
||||
|
||||
getCodegenConfig().processOpts();
|
||||
@@ -28,7 +36,7 @@ public abstract class AbstractOptionsTest {
|
||||
@Test(description = "check if all options described in documentation are presented in test case")
|
||||
public void checkOptionsHelp() {
|
||||
final List<String> cliOptions = Lists.transform(getCodegenConfig().cliOptions(), getCliOptionTransformer());
|
||||
final Set<String> testOptions = getAvaliableOptions().keySet();
|
||||
final Set<String> testOptions = optionsProvider.createOptions().keySet();
|
||||
final Set<String> skipped = new HashSet<String>(cliOptions);
|
||||
skipped.removeAll(testOptions);
|
||||
if (!skipped.isEmpty()) {
|
||||
@@ -52,6 +60,4 @@ public abstract class AbstractOptionsTest {
|
||||
protected abstract CodegenConfig getCodegenConfig();
|
||||
|
||||
protected abstract void setExpectations();
|
||||
|
||||
protected abstract Map<String, String> getAvaliableOptions();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.akkascala;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.AkkaScalaClientCodegen;
|
||||
import io.swagger.codegen.options.AkkaScalaClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class AkkaScalaClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private AkkaScalaClientCodegen clientCodegen;
|
||||
|
||||
public AkkaScalaClientOptionsTest() {
|
||||
super(new AkkaScalaClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(AkkaScalaClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(AkkaScalaClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AkkaScalaClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -2,29 +2,21 @@ package io.swagger.codegen.android;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.AndroidClientCodegen;
|
||||
import io.swagger.codegen.options.AndroidClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AndroidClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String ARTIFACT_ID_VALUE = "swagger-java-client-test";
|
||||
protected static final String MODEL_PACKAGE_VALUE = "package";
|
||||
protected static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
protected static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test";
|
||||
protected static final String SORT_PARAMS_VALUE = "false";
|
||||
protected static final String GROUP_ID_VALUE = "io.swagger.test";
|
||||
protected static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
protected static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
|
||||
protected static final String ANDROID_MAVEN_GRADLE_PLUGIN_VALUE = "true";
|
||||
|
||||
@Tested
|
||||
private AndroidClientCodegen clientCodegen;
|
||||
|
||||
public AndroidClientOptionsTest() {
|
||||
super(new AndroidClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -33,39 +25,24 @@ public class AndroidClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(AndroidClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(AndroidClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AndroidClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(INVOKER_PACKAGE_VALUE);
|
||||
clientCodegen.setInvokerPackage(AndroidClientOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(GROUP_ID_VALUE);
|
||||
clientCodegen.setGroupId(AndroidClientOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(ARTIFACT_ID_VALUE);
|
||||
clientCodegen.setArtifactId(AndroidClientOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(ARTIFACT_VERSION_VALUE);
|
||||
clientCodegen.setArtifactVersion(AndroidClientOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SOURCE_FOLDER_VALUE);
|
||||
clientCodegen.setSourceFolder(AndroidClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setUseAndroidMavenGradlePlugin(Boolean.valueOf(ANDROID_MAVEN_GRADLE_PLUGIN_VALUE));
|
||||
clientCodegen.setUseAndroidMavenGradlePlugin(Boolean.valueOf(AndroidClientOptionsProvider.ANDROID_MAVEN_GRADLE_PLUGIN_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(AndroidClientCodegen.USE_ANDROID_MAVEN_GRADLE_PLUGIN, ANDROID_MAVEN_GRADLE_PLUGIN_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.asyncscala;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.AsyncScalaClientCodegen;
|
||||
import io.swagger.codegen.options.AsyncScalaClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class AsyncScalaClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private AsyncScalaClientCodegen clientCodegen;
|
||||
|
||||
public AsyncScalaClientOptionsTest() {
|
||||
super(new AsyncScalaClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(AsyncScalaClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(AsyncScalaClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(AsyncScalaClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -2,22 +2,21 @@ package io.swagger.codegen.csharp;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.CSharpClientCodegen;
|
||||
import io.swagger.codegen.options.CSharpClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CSharpClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String PACKAGE_NAME_VALUE = "swagger_client_csharp";
|
||||
protected static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Tested
|
||||
private CSharpClientCodegen clientCodegen;
|
||||
|
||||
public CSharpClientOptionsTest() {
|
||||
super(new CSharpClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -26,18 +25,10 @@ public class CSharpClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setPackageName(PACKAGE_NAME_VALUE);
|
||||
clientCodegen.setPackageName(CSharpClientOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageVersion(PACKAGE_VERSION_VALUE);
|
||||
clientCodegen.setPackageVersion(CSharpClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,23 +2,21 @@ package io.swagger.codegen.csharpdotnettwo;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.CsharpDotNet2ClientCodegen;
|
||||
import io.swagger.codegen.options.CsharpDotNet2ClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CsharpDotNet2ClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String PACKAGE_NAME_VALUE = "swagger_client_csharp_dotnet";
|
||||
protected static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
protected static final String CLIENT_PACKAGE_VALUE = "IO.Swagger.Client.Test";
|
||||
|
||||
@Tested
|
||||
private CsharpDotNet2ClientCodegen clientCodegen;
|
||||
|
||||
public CsharpDotNet2ClientOptionsTest() {
|
||||
super(new CsharpDotNet2ClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -27,21 +25,12 @@ public class CsharpDotNet2ClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setPackageName(PACKAGE_NAME_VALUE);
|
||||
clientCodegen.setPackageName(CsharpDotNet2ClientOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageVersion(PACKAGE_VERSION_VALUE);
|
||||
clientCodegen.setPackageVersion(CsharpDotNet2ClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setClientPackage(CLIENT_PACKAGE_VALUE);
|
||||
clientCodegen.setClientPackage(CsharpDotNet2ClientOptionsProvider.CLIENT_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.put(CsharpDotNet2ClientCodegen.CLIENT_PACKAGE, CLIENT_PACKAGE_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,28 +2,21 @@ package io.swagger.codegen.dart;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.DartClientCodegen;
|
||||
import io.swagger.codegen.options.DartClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DartClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String MODEL_PACKAGE_VALUE = "packagedart";
|
||||
protected static final String API_PACKAGE_VALUE = "apiPackageDart";
|
||||
protected static final String SORT_PARAMS_VALUE = "false";
|
||||
protected static final String BROWSER_CLIENT_VALUE = "true";
|
||||
protected static final String PUB_NAME_VALUE = "swagger";
|
||||
protected static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
protected static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
|
||||
protected static final String SOURCE_FOLDER_VALUE = "src";
|
||||
|
||||
@Tested
|
||||
private DartClientCodegen clientCodegen;
|
||||
|
||||
public DartClientOptionsTest() {
|
||||
super(new DartClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -32,37 +25,23 @@ public class DartClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(DartClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(DartClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(DartClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setBrowserClient(Boolean.valueOf(BROWSER_CLIENT_VALUE));
|
||||
clientCodegen.setBrowserClient(Boolean.valueOf(DartClientOptionsProvider.BROWSER_CLIENT_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setPubName(PUB_NAME_VALUE);
|
||||
clientCodegen.setPubName(DartClientOptionsProvider.PUB_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPubVersion(PUB_VERSION_VALUE);
|
||||
clientCodegen.setPubVersion(DartClientOptionsProvider.PUB_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPubDescription(PUB_DESCRIPTION_VALUE);
|
||||
clientCodegen.setPubDescription(DartClientOptionsProvider.PUB_DESCRIPTION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SOURCE_FOLDER_VALUE);
|
||||
clientCodegen.setSourceFolder(DartClientOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(DartClientCodegen.BROWSER_CLIENT, BROWSER_CLIENT_VALUE)
|
||||
.put(DartClientCodegen.PUB_NAME, PUB_NAME_VALUE)
|
||||
.put(DartClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
|
||||
.put(DartClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,24 +2,23 @@ package io.swagger.codegen.flash;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.FlashClientCodegen;
|
||||
import io.swagger.codegen.options.FlashClienOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FlashClienOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String PACKAGE_NAME_VALUE = "io.swagger.flash";
|
||||
protected static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
protected static final String INVOKER_PACKAGE_VALUE = "io.swagger.flash";
|
||||
protected static final String SOURCE_FOLDER_VALUE = "src/main/flex/test";
|
||||
|
||||
@Tested
|
||||
private FlashClientCodegen clientCodegen;
|
||||
|
||||
public FlashClienOptionsTest() {
|
||||
super(new FlashClienOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -28,24 +27,14 @@ public class FlashClienOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setPackageName(PACKAGE_NAME_VALUE);
|
||||
clientCodegen.setPackageName(FlashClienOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageVersion(PACKAGE_VERSION_VALUE);
|
||||
clientCodegen.setPackageVersion(FlashClienOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(INVOKER_PACKAGE_VALUE);
|
||||
clientCodegen.setInvokerPackage(FlashClienOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SOURCE_FOLDER_VALUE);
|
||||
clientCodegen.setSourceFolder(FlashClienOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
package io.swagger.codegen.inflector;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.java.JavaClientOptionsTest;
|
||||
import io.swagger.codegen.languages.JavaInflectorServerCodegen;
|
||||
import io.swagger.codegen.options.JavaInflectorServerOptionsProvider;
|
||||
import io.swagger.codegen.options.JavaOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class JavaInflectorServerOptionsTest extends JavaClientOptionsTest {
|
||||
|
||||
@Tested
|
||||
private JavaInflectorServerCodegen clientCodegen;
|
||||
|
||||
public JavaInflectorServerOptionsTest() {
|
||||
super(new JavaInflectorServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(JavaInflectorServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(JavaInflectorServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(JavaInflectorServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(JavaInflectorServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(JavaInflectorServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(JavaInflectorServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(JavaInflectorServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(JavaInflectorServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(JavaInflectorServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(JavaInflectorServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLibrary(JavaInflectorServerOptionsProvider.LIBRARY_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaInflectorServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -2,33 +2,26 @@ package io.swagger.codegen.java;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.options.JavaOptionsProvider;
|
||||
import io.swagger.codegen.languages.JavaClientCodegen;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class JavaClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
protected static final String ARTIFACT_ID_VALUE = "swagger-java-client-test";
|
||||
protected static final String MODEL_PACKAGE_VALUE = "package";
|
||||
protected static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
protected static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test";
|
||||
protected static final String SORT_PARAMS_VALUE = "false";
|
||||
protected static final String GROUP_ID_VALUE = "io.swagger.test";
|
||||
protected static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
protected static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
|
||||
protected static final String LOCAL_PREFIX_VALUE = "tst";
|
||||
protected static final String LIBRARY_VALUE = "jersey2";
|
||||
protected static final String SERIALIZABLE_MODEL_VALUE = "false";
|
||||
protected static final String FULL_JAVA_UTIL_VALUE = "true";
|
||||
|
||||
@Tested
|
||||
private JavaClientCodegen clientCodegen;
|
||||
|
||||
public JavaClientOptionsTest() {
|
||||
super(new JavaOptionsProvider());
|
||||
}
|
||||
|
||||
protected JavaClientOptionsTest(OptionsProvider optionsProvider) {
|
||||
super(optionsProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -37,48 +30,30 @@ public class JavaClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(JavaOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(JavaOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(JavaOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(INVOKER_PACKAGE_VALUE);
|
||||
clientCodegen.setInvokerPackage(JavaOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(GROUP_ID_VALUE);
|
||||
clientCodegen.setGroupId(JavaOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(ARTIFACT_ID_VALUE);
|
||||
clientCodegen.setArtifactId(JavaOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(ARTIFACT_VERSION_VALUE);
|
||||
clientCodegen.setArtifactVersion(JavaOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SOURCE_FOLDER_VALUE);
|
||||
clientCodegen.setSourceFolder(JavaOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(LOCAL_PREFIX_VALUE);
|
||||
clientCodegen.setLocalVariablePrefix(JavaOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(SERIALIZABLE_MODEL_VALUE));
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(JavaOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLibrary(LIBRARY_VALUE);
|
||||
clientCodegen.setLibrary(JavaOptionsProvider.LIBRARY_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(FULL_JAVA_UTIL_VALUE));
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JavaOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(CodegenConstants.LOCAL_VARIABLE_PREFIX, LOCAL_PREFIX_VALUE)
|
||||
.put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE)
|
||||
.put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE)
|
||||
.put(CodegenConstants.LIBRARY, LIBRARY_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package io.swagger.codegen.jaxrs;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.java.JavaClientOptionsTest;
|
||||
import io.swagger.codegen.languages.JaxRSServerCodegen;
|
||||
import io.swagger.codegen.options.JaxRSServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
@@ -12,6 +13,10 @@ public class JaxRSServerOptionsTest extends JavaClientOptionsTest {
|
||||
@Tested
|
||||
private JaxRSServerCodegen clientCodegen;
|
||||
|
||||
public JaxRSServerOptionsTest() {
|
||||
super(new JaxRSServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -20,29 +25,29 @@ public class JaxRSServerOptionsTest extends JavaClientOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(JaxRSServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(JaxRSServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(JaxRSServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(INVOKER_PACKAGE_VALUE);
|
||||
clientCodegen.setInvokerPackage(JaxRSServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(GROUP_ID_VALUE);
|
||||
clientCodegen.setGroupId(JaxRSServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(ARTIFACT_ID_VALUE);
|
||||
clientCodegen.setArtifactId(JaxRSServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(ARTIFACT_VERSION_VALUE);
|
||||
clientCodegen.setArtifactVersion(JaxRSServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SOURCE_FOLDER_VALUE);
|
||||
clientCodegen.setSourceFolder(JaxRSServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(LOCAL_PREFIX_VALUE);
|
||||
clientCodegen.setLocalVariablePrefix(JaxRSServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(SERIALIZABLE_MODEL_VALUE));
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(JaxRSServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLibrary(LIBRARY_VALUE);
|
||||
clientCodegen.setLibrary(JaxRSServerOptionsProvider.LIBRARY_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(FULL_JAVA_UTIL_VALUE));
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JaxRSServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@@ -2,24 +2,21 @@ package io.swagger.codegen.nodejs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaClientCodegen;
|
||||
import io.swagger.codegen.languages.NodeJSServerCodegen;
|
||||
import io.swagger.codegen.options.NodeJSServerOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class NodeJSServerOptionsTest extends AbstractOptionsTest {
|
||||
private static final String MODEL_PACKAGE_VALUE = "package";
|
||||
private static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
private static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Tested
|
||||
private NodeJSServerCodegen clientCodegen;
|
||||
|
||||
public NodeJSServerOptionsTest() {
|
||||
super(new NodeJSServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -28,21 +25,12 @@ public class NodeJSServerOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(NodeJSServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(NodeJSServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(NodeJSServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package io.swagger.codegen.objc;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.ObjcClientCodegen;
|
||||
import io.swagger.codegen.options.ObjcClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class ObjcClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private ObjcClientCodegen clientCodegen;
|
||||
|
||||
public ObjcClientOptionsTest() {
|
||||
super(new ObjcClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setClassPrefix(ObjcClientOptionsProvider.CLASS_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPodName(ObjcClientOptionsProvider.POD_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPodVersion(ObjcClientOptionsProvider.POD_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setAuthorName(ObjcClientOptionsProvider.AUTHOR_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setAuthorEmail(ObjcClientOptionsProvider.AUTHOR_EMAIL_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLicense(ObjcClientOptionsProvider.LICENSE_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AkkaScalaClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "akka-scala";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.AndroidClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AndroidClientOptionsProvider implements OptionsProvider {
|
||||
public static final String ARTIFACT_ID_VALUE = "swagger-java-client-test";
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String GROUP_ID_VALUE = "io.swagger.test";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
|
||||
public static final String ANDROID_MAVEN_GRADLE_PLUGIN_VALUE = "true";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "android";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(AndroidClientCodegen.USE_ANDROID_MAVEN_GRADLE_PLUGIN, ANDROID_MAVEN_GRADLE_PLUGIN_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class AsyncScalaClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "async-scala";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CSharpClientOptionsProvider implements OptionsProvider {
|
||||
public static final String PACKAGE_NAME_VALUE = "swagger_client_csharp";
|
||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "csharp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.CsharpDotNet2ClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CsharpDotNet2ClientOptionsProvider implements OptionsProvider {
|
||||
public static final String PACKAGE_NAME_VALUE = "swagger_client_csharp_dotnet";
|
||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String CLIENT_PACKAGE_VALUE = "IO.Swagger.Client.Test";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "CsharpDotNet2";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.put(CsharpDotNet2ClientCodegen.CLIENT_PACKAGE, CLIENT_PACKAGE_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.DartClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class DartClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "packagedart";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackageDart";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String BROWSER_CLIENT_VALUE = "true";
|
||||
public static final String PUB_NAME_VALUE = "swagger";
|
||||
public static final String PUB_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String PUB_DESCRIPTION_VALUE = "Swagger API client dart";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "dart";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(DartClientCodegen.BROWSER_CLIENT, BROWSER_CLIENT_VALUE)
|
||||
.put(DartClientCodegen.PUB_NAME, PUB_NAME_VALUE)
|
||||
.put(DartClientCodegen.PUB_VERSION, PUB_VERSION_VALUE)
|
||||
.put(DartClientCodegen.PUB_DESCRIPTION, PUB_DESCRIPTION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class FlashClienOptionsProvider implements OptionsProvider {
|
||||
public static final String PACKAGE_NAME_VALUE = "io.swagger.flash";
|
||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "io.swagger.flash";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src/main/flex/test";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "flash";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
public class JavaInflectorServerOptionsProvider extends JavaOptionsProvider {
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "inflector";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class JavaOptionsProvider implements OptionsProvider {
|
||||
public static final String ARTIFACT_ID_VALUE = "swagger-java-client-test";
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "io.swagger.client.test";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String GROUP_ID_VALUE = "io.swagger.test";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String SOURCE_FOLDER_VALUE = "src/main/java/test";
|
||||
public static final String LOCAL_PREFIX_VALUE = "tst";
|
||||
public static final String LIBRARY_VALUE = "jersey2";
|
||||
public static final String SERIALIZABLE_MODEL_VALUE = "false";
|
||||
public static final String FULL_JAVA_UTIL_VALUE = "true";
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.GROUP_ID, GROUP_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_ID, ARTIFACT_ID_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.put(CodegenConstants.SOURCE_FOLDER, SOURCE_FOLDER_VALUE)
|
||||
.put(CodegenConstants.LOCAL_VARIABLE_PREFIX, LOCAL_PREFIX_VALUE)
|
||||
.put(CodegenConstants.SERIALIZABLE_MODEL, SERIALIZABLE_MODEL_VALUE)
|
||||
.put(JavaClientCodegen.FULL_JAVA_UTIL, FULL_JAVA_UTIL_VALUE)
|
||||
.put(CodegenConstants.LIBRARY, LIBRARY_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "java";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
public class JaxRSServerOptionsProvider extends JavaOptionsProvider {
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "jaxrs";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class NodeJSServerOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "nodejs";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.ObjcClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ObjcClientOptionsProvider implements OptionsProvider {
|
||||
public static final String CLASS_PREFIX_VALUE = "SWGObjc";
|
||||
public static final String POD_NAME_VALUE = "SwaggerClientObjc";
|
||||
public static final String POD_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
public static final String AUTHOR_NAME_VALUE = "SwaggerObjc";
|
||||
public static final String AUTHOR_EMAIL_VALUE = "objc@swagger.io";
|
||||
public static final String GIT_REPO_URL_VALUE = "https://github.com/swagger-api/swagger-codegen";
|
||||
public static final String LICENSE_VALUE = "MIT";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "objc";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(ObjcClientCodegen.CLASS_PREFIX, CLASS_PREFIX_VALUE)
|
||||
.put(ObjcClientCodegen.POD_NAME, POD_NAME_VALUE)
|
||||
.put(CodegenConstants.POD_VERSION, POD_VERSION_VALUE)
|
||||
.put(ObjcClientCodegen.AUTHOR_NAME, AUTHOR_NAME_VALUE)
|
||||
.put(ObjcClientCodegen.AUTHOR_EMAIL, AUTHOR_EMAIL_VALUE)
|
||||
.put(ObjcClientCodegen.GIT_REPO_URL, GIT_REPO_URL_VALUE)
|
||||
.put(ObjcClientCodegen.LICENSE, LICENSE_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public interface OptionsProvider {
|
||||
String getLanguage();
|
||||
Map<String, String> createOptions();
|
||||
boolean isServer();
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.languages.PerlClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PerlClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODULE_NAME_VALUE = "";
|
||||
public static final String MODULE_VERSION_VALUE = "";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "perl";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(PerlClientCodegen.MODULE_NAME, MODULE_NAME_VALUE)
|
||||
.put(PerlClientCodegen.MODULE_VERSION, MODULE_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.PhpClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PhpClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String VARIABLE_NAMING_CONVENTION_VALUE = "snake_case";
|
||||
public static final String INVOKER_PACKAGE_VALUE = "Swagger\\Client\\Php";
|
||||
public static final String PACKAGE_PATH_VALUE = "SwaggerClient-php";
|
||||
public static final String SRC_BASE_PATH_VALUE = "libPhp";
|
||||
public static final String COMPOSER_VENDOR_NAME_VALUE = "swaggerPhp";
|
||||
public static final String COMPOSER_PROJECT_NAME_VALUE = "swagger-client-php";
|
||||
public static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "php";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(PhpClientCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(PhpClientCodegen.PACKAGE_PATH, PACKAGE_PATH_VALUE)
|
||||
.put(PhpClientCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE)
|
||||
.put(PhpClientCodegen.COMPOSER_VENDOR_NAME, COMPOSER_VENDOR_NAME_VALUE)
|
||||
.put(PhpClientCodegen.COMPOSER_PROJECT_NAME, COMPOSER_PROJECT_NAME_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PythonClientOptionsProvider implements OptionsProvider {
|
||||
public static final String PACKAGE_NAME_VALUE = "swagger_client_python";
|
||||
public static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "python";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class Qt5CPPOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "qt5cpp";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.languages.RubyClientCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RubyClientOptionsProvider implements OptionsProvider {
|
||||
public static final String GEM_NAME_VALUE = "swagger_client_ruby";
|
||||
public static final String MODULE_NAME_VALUE = "SwaggerClientRuby";
|
||||
public static final String GEM_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "ruby";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(RubyClientCodegen.GEM_NAME, GEM_NAME_VALUE)
|
||||
.put(RubyClientCodegen.MODULE_NAME, MODULE_NAME_VALUE)
|
||||
.put(RubyClientCodegen.GEM_VERSION, GEM_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ScalaClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "scala";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class ScalatraServerOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "scalatra";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SilexServerOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "silex-PHP";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SinatraServerOptionsProvider implements OptionsProvider {
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "sinatra";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
//SinatraServerCodegen doesn't have its own options and base options are cleared
|
||||
return ImmutableMap.of();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.languages.SpringMVCServerCodegen;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public class SpringMVCServerOptionsProvider extends JavaOptionsProvider {
|
||||
public static final String CONFIG_PACKAGE_VALUE = "configPackage";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "spring-mvc";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
Map<String, String> options = new HashMap<String, String>(super.createOptions());
|
||||
options.put(SpringMVCServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE);
|
||||
return options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StaticDocOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "dynamic-html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class StaticHtmlOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "html";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SwaggerOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "swagger";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SwaggerYamlOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "swagger-yaml";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.SwiftCodegen;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class SwiftOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
public static final String PROJECT_NAME_VALUE = "Swagger";
|
||||
public static final String RESPONSE_AS_VALUE = "test";
|
||||
public static final String UNWRAP_REQUIRED_VALUE = "true";
|
||||
public static final String POD_SOURCE_VALUE = "{ :git => 'git@github.com:swagger-api/swagger-mustache.git'," +
|
||||
" :tag => 'v1.0.0-SNAPSHOT' }";
|
||||
public static final String POD_VERSION_VALUE = "v1.0.0-SNAPSHOT";
|
||||
public static final String POD_AUTHORS_VALUE = "podAuthors";
|
||||
public static final String POD_SOCIAL_MEDIA_URL_VALUE = "podSocialMediaURL";
|
||||
public static final String POD_DOCSET_URL_VALUE = "podDocsetURL";
|
||||
public static final String POD_LICENSE_VALUE = "'Apache License, Version 2.0'";
|
||||
public static final String POD_HOMEPAGE_VALUE = "podHomepage";
|
||||
public static final String POD_SUMMARY_VALUE = "podSummary";
|
||||
public static final String POD_DESCRIPTION_VALUE = "podDescription";
|
||||
public static final String POD_SCREENSHOTS_VALUE = "podScreenshots";
|
||||
public static final String POD_DOCUMENTATION_URL_VALUE = "podDocumentationURL";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "swift";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(SwiftCodegen.PROJECT_NAME, PROJECT_NAME_VALUE)
|
||||
.put(SwiftCodegen.RESPONSE_AS, RESPONSE_AS_VALUE)
|
||||
.put(SwiftCodegen.UNWRAP_REQUIRED, UNWRAP_REQUIRED_VALUE)
|
||||
.put(SwiftCodegen.POD_SOURCE, POD_SOURCE_VALUE)
|
||||
.put(CodegenConstants.POD_VERSION, POD_VERSION_VALUE)
|
||||
.put(SwiftCodegen.POD_AUTHORS, POD_AUTHORS_VALUE)
|
||||
.put(SwiftCodegen.POD_SOCIAL_MEDIA_URL, POD_SOCIAL_MEDIA_URL_VALUE)
|
||||
.put(SwiftCodegen.POD_DOCSET_URL, POD_DOCSET_URL_VALUE)
|
||||
.put(SwiftCodegen.POD_LICENSE, POD_LICENSE_VALUE)
|
||||
.put(SwiftCodegen.POD_HOMEPAGE, POD_HOMEPAGE_VALUE)
|
||||
.put(SwiftCodegen.POD_SUMMARY, POD_SUMMARY_VALUE)
|
||||
.put(SwiftCodegen.POD_DESCRIPTION, POD_DESCRIPTION_VALUE)
|
||||
.put(SwiftCodegen.POD_SCREENSHOTS, POD_SCREENSHOTS_VALUE)
|
||||
.put(SwiftCodegen.POD_DOCUMENTATION_URL, POD_DOCUMENTATION_URL_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class TizenClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "tizen";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class TypeScriptAngularClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "typescript-angular";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package io.swagger.codegen.options;
|
||||
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class TypeScriptNodeClientOptionsProvider implements OptionsProvider {
|
||||
public static final String MODEL_PACKAGE_VALUE = "package";
|
||||
public static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
public static final String SORT_PARAMS_VALUE = "false";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
return "typescript-node";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package io.swagger.codegen.perl;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.PerlClientCodegen;
|
||||
import io.swagger.codegen.options.PerlClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class PerlClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private PerlClientCodegen clientCodegen;
|
||||
|
||||
public PerlClientOptionsTest() {
|
||||
super(new PerlClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModuleName(PerlClientOptionsProvider.MODULE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setModuleVersion(PerlClientOptionsProvider.MODULE_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -2,30 +2,21 @@ package io.swagger.codegen.php;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.PhpClientCodegen;
|
||||
import io.swagger.codegen.options.PhpClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PhpClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String MODEL_PACKAGE_VALUE = "package";
|
||||
protected static final String API_PACKAGE_VALUE = "apiPackage";
|
||||
protected static final String SORT_PARAMS_VALUE = "false";
|
||||
protected static final String VARIABLE_NAMING_CONVENTION_VALUE = "snake_case";
|
||||
protected static final String INVOKER_PACKAGE_VALUE = "Swagger\\Client\\Php";
|
||||
protected static final String PACKAGE_PATH_VALUE = "SwaggerClient-php";
|
||||
protected static final String SRC_BASE_PATH_VALUE = "libPhp";
|
||||
protected static final String COMPOSER_VENDOR_NAME_VALUE = "swaggerPhp";
|
||||
protected static final String COMPOSER_PROJECT_NAME_VALUE = "swagger-client-php";
|
||||
protected static final String ARTIFACT_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Tested
|
||||
private PhpClientCodegen clientCodegen;
|
||||
|
||||
public PhpClientOptionsTest() {
|
||||
super(new PhpClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -34,42 +25,26 @@ public class PhpClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(MODEL_PACKAGE_VALUE);
|
||||
clientCodegen.setModelPackage(PhpClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(API_PACKAGE_VALUE);
|
||||
clientCodegen.setApiPackage(PhpClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SORT_PARAMS_VALUE));
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(PhpClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setParameterNamingConvention(VARIABLE_NAMING_CONVENTION_VALUE);
|
||||
clientCodegen.setParameterNamingConvention(PhpClientOptionsProvider.VARIABLE_NAMING_CONVENTION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(INVOKER_PACKAGE_VALUE);
|
||||
clientCodegen.setInvokerPackage(PhpClientOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackagePath(PACKAGE_PATH_VALUE);
|
||||
clientCodegen.setPackagePath(PhpClientOptionsProvider.PACKAGE_PATH_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSrcBasePath(SRC_BASE_PATH_VALUE);
|
||||
clientCodegen.setSrcBasePath(PhpClientOptionsProvider.SRC_BASE_PATH_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setComposerVendorName(COMPOSER_VENDOR_NAME_VALUE);
|
||||
clientCodegen.setComposerVendorName(PhpClientOptionsProvider.COMPOSER_VENDOR_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setComposerProjectName(COMPOSER_PROJECT_NAME_VALUE);
|
||||
clientCodegen.setComposerProjectName(PhpClientOptionsProvider.COMPOSER_PROJECT_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(ARTIFACT_VERSION_VALUE);
|
||||
clientCodegen.setArtifactVersion(PhpClientOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.MODEL_PACKAGE, MODEL_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.API_PACKAGE, API_PACKAGE_VALUE)
|
||||
.put(CodegenConstants.SORT_PARAMS_BY_REQUIRED_FLAG, SORT_PARAMS_VALUE)
|
||||
.put(PhpClientCodegen.VARIABLE_NAMING_CONVENTION, VARIABLE_NAMING_CONVENTION_VALUE)
|
||||
.put(CodegenConstants.INVOKER_PACKAGE, INVOKER_PACKAGE_VALUE)
|
||||
.put(PhpClientCodegen.PACKAGE_PATH, PACKAGE_PATH_VALUE)
|
||||
.put(PhpClientCodegen.SRC_BASE_PATH, SRC_BASE_PATH_VALUE)
|
||||
.put(PhpClientCodegen.COMPOSER_VENDOR_NAME, COMPOSER_VENDOR_NAME_VALUE)
|
||||
.put(PhpClientCodegen.COMPOSER_PROJECT_NAME, COMPOSER_PROJECT_NAME_VALUE)
|
||||
.put(CodegenConstants.ARTIFACT_VERSION, ARTIFACT_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,22 +2,21 @@ package io.swagger.codegen.python;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.PythonClientCodegen;
|
||||
import io.swagger.codegen.options.PythonClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class PythonClientOptionsTest extends AbstractOptionsTest {
|
||||
protected static final String PACKAGE_NAME_VALUE = "swagger_client_python";
|
||||
protected static final String PACKAGE_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Tested
|
||||
private PythonClientCodegen clientCodegen;
|
||||
|
||||
public PythonClientOptionsTest() {
|
||||
super(new PythonClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -26,18 +25,10 @@ public class PythonClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setPackageName(PACKAGE_NAME_VALUE);
|
||||
clientCodegen.setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageVersion(PACKAGE_VERSION_VALUE);
|
||||
clientCodegen.setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(CodegenConstants.PACKAGE_NAME, PACKAGE_NAME_VALUE)
|
||||
.put(CodegenConstants.PACKAGE_VERSION, PACKAGE_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.qtfivecpp;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.Qt5CPPGenerator;
|
||||
import io.swagger.codegen.options.Qt5CPPOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class Qt5CPPOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private Qt5CPPGenerator clientCodegen;
|
||||
|
||||
public Qt5CPPOptionsTest() {
|
||||
super(new Qt5CPPOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(Qt5CPPOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(Qt5CPPOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(Qt5CPPOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,20 @@ package io.swagger.codegen.ruby;
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.RubyClientCodegen;
|
||||
import io.swagger.codegen.options.RubyClientOptionsProvider;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class RubyClientOptionsTest extends AbstractOptionsTest {
|
||||
private static final String GEM_NAME_VALUE = "swagger_client_ruby";
|
||||
private static final String MODULE_NAME_VALUE = "SwaggerClientRuby";
|
||||
private static final String GEM_VERSION_VALUE = "1.0.0-SNAPSHOT";
|
||||
|
||||
@Tested
|
||||
private RubyClientCodegen clientCodegen;
|
||||
|
||||
public RubyClientOptionsTest() {
|
||||
super(new RubyClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
@@ -26,21 +25,12 @@ public class RubyClientOptionsTest extends AbstractOptionsTest {
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setGemName(GEM_NAME_VALUE);
|
||||
clientCodegen.setGemName(RubyClientOptionsProvider.GEM_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setModuleName(MODULE_NAME_VALUE);
|
||||
clientCodegen.setModuleName(RubyClientOptionsProvider.MODULE_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGemVersion(GEM_VERSION_VALUE);
|
||||
clientCodegen.setGemVersion(RubyClientOptionsProvider.GEM_VERSION_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getAvaliableOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put(RubyClientCodegen.GEM_NAME, GEM_NAME_VALUE)
|
||||
.put(RubyClientCodegen.MODULE_NAME, MODULE_NAME_VALUE)
|
||||
.put(RubyClientCodegen.GEM_VERSION, GEM_VERSION_VALUE)
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.scala;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.ScalaClientCodegen;
|
||||
import io.swagger.codegen.options.ScalaClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class ScalaClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private ScalaClientCodegen clientCodegen;
|
||||
|
||||
public ScalaClientOptionsTest() {
|
||||
super(new ScalaClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(ScalaClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(ScalaClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(ScalaClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.scalatra;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.ScalatraServerCodegen;
|
||||
import io.swagger.codegen.options.ScalatraServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class ScalatraServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private ScalatraServerCodegen clientCodegen;
|
||||
|
||||
public ScalatraServerOptionsTest() {
|
||||
super(new ScalatraServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(ScalatraServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(ScalatraServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(ScalatraServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.silex;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.SilexServerCodegen;
|
||||
import io.swagger.codegen.options.SilexServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SilexServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SilexServerCodegen clientCodegen;
|
||||
|
||||
public SilexServerOptionsTest() {
|
||||
super(new SilexServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(SilexServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(SilexServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SilexServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package io.swagger.codegen.sinatra;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.SinatraServerCodegen;
|
||||
import io.swagger.codegen.options.SinatraServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SinatraServerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SinatraServerCodegen clientCodegen;
|
||||
|
||||
public SinatraServerOptionsTest() {
|
||||
super(new SinatraServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package io.swagger.codegen.springmvc;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.java.JavaClientOptionsTest;
|
||||
import io.swagger.codegen.languages.SpringMVCServerCodegen;
|
||||
import io.swagger.codegen.options.SpringMVCServerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SpringMVCServerOptionsTest extends JavaClientOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SpringMVCServerCodegen clientCodegen;
|
||||
|
||||
public SpringMVCServerOptionsTest() {
|
||||
super(new SpringMVCServerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(SpringMVCServerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(SpringMVCServerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SpringMVCServerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setInvokerPackage(SpringMVCServerOptionsProvider.INVOKER_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setGroupId(SpringMVCServerOptionsProvider.GROUP_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactId(SpringMVCServerOptionsProvider.ARTIFACT_ID_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setArtifactVersion(SpringMVCServerOptionsProvider.ARTIFACT_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSourceFolder(SpringMVCServerOptionsProvider.SOURCE_FOLDER_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLocalVariablePrefix(SpringMVCServerOptionsProvider.LOCAL_PREFIX_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(SpringMVCServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLibrary(SpringMVCServerOptionsProvider.LIBRARY_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(SpringMVCServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setConfigPackage(SpringMVCServerOptionsProvider.CONFIG_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.staticDocs;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.StaticDocCodegen;
|
||||
import io.swagger.codegen.options.StaticDocOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class StaticDocOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private StaticDocCodegen clientCodegen;
|
||||
|
||||
public StaticDocOptionsTest() {
|
||||
super(new StaticDocOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(StaticDocOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(StaticDocOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(StaticDocOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.statichtml;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.StaticHtmlGenerator;
|
||||
import io.swagger.codegen.options.StaticHtmlOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class StaticHtmlOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private StaticHtmlGenerator clientCodegen;
|
||||
|
||||
public StaticHtmlOptionsTest() {
|
||||
super(new StaticHtmlOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(StaticHtmlOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(StaticHtmlOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(StaticHtmlOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.swagger;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.SwaggerGenerator;
|
||||
import io.swagger.codegen.options.SwaggerOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SwaggerOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SwaggerGenerator clientCodegen;
|
||||
|
||||
public SwaggerOptionsTest() {
|
||||
super(new SwaggerOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(SwaggerOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(SwaggerOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SwaggerOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.swaggeryaml;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.SwaggerYamlGenerator;
|
||||
import io.swagger.codegen.options.SwaggerYamlOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SwaggerYamlOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SwaggerYamlGenerator clientCodegen;
|
||||
|
||||
public SwaggerYamlOptionsTest() {
|
||||
super(new SwaggerYamlOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(SwaggerYamlOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(SwaggerYamlOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SwaggerYamlOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package io.swagger.codegen.swift;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.SwiftCodegen;
|
||||
import io.swagger.codegen.options.SwiftOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class SwiftOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private SwiftCodegen clientCodegen;
|
||||
|
||||
public SwiftOptionsTest() {
|
||||
super(new SwiftOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(SwiftOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(SwiftOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(SwiftOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setProjectName(SwiftOptionsProvider.PROJECT_NAME_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setResponseAs(SwiftOptionsProvider.RESPONSE_AS_VALUE.split(","));
|
||||
times = 1;
|
||||
clientCodegen.setUnwrapRequired(Boolean.valueOf(SwiftOptionsProvider.UNWRAP_REQUIRED_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.tizen;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.TizenClientCodegen;
|
||||
import io.swagger.codegen.options.TizenClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class TizenClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private TizenClientCodegen clientCodegen;
|
||||
|
||||
public TizenClientOptionsTest() {
|
||||
super(new TizenClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(TizenClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(TizenClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TizenClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.typescriptangular;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.TypeScriptAngularClientCodegen;
|
||||
import io.swagger.codegen.options.TypeScriptAngularClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class TypeScriptAngularClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private TypeScriptAngularClientCodegen clientCodegen;
|
||||
|
||||
public TypeScriptAngularClientOptionsTest() {
|
||||
super(new TypeScriptAngularClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(TypeScriptAngularClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(TypeScriptAngularClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptAngularClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package io.swagger.codegen.typescriptnode;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.languages.TypeScriptNodeClientCodegen;
|
||||
import io.swagger.codegen.options.TypeScriptNodeClientOptionsProvider;
|
||||
|
||||
import mockit.Expectations;
|
||||
import mockit.Tested;
|
||||
|
||||
public class TypeScriptNodeClientOptionsTest extends AbstractOptionsTest {
|
||||
|
||||
@Tested
|
||||
private TypeScriptNodeClientCodegen clientCodegen;
|
||||
|
||||
public TypeScriptNodeClientOptionsTest() {
|
||||
super(new TypeScriptNodeClientOptionsProvider());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected CodegenConfig getCodegenConfig() {
|
||||
return clientCodegen;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setExpectations() {
|
||||
new Expectations(clientCodegen) {{
|
||||
clientCodegen.setModelPackage(TypeScriptNodeClientOptionsProvider.MODEL_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setApiPackage(TypeScriptNodeClientOptionsProvider.API_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setSortParamsByRequiredFlag(Boolean.valueOf(TypeScriptNodeClientOptionsProvider.SORT_PARAMS_VALUE));
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
@@ -149,6 +149,13 @@
|
||||
<artifactId>swagger-codegen</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-codegen</artifactId>
|
||||
<version>${project.parent.version}</version>
|
||||
<type>test-jar</type>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.logback</groupId>
|
||||
<artifactId>logback-classic</artifactId>
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class Generator {
|
||||
static Logger LOGGER = LoggerFactory.getLogger(Generator.class);
|
||||
|
||||
@@ -2,14 +2,45 @@ package io.swagger.generator.online;
|
||||
|
||||
import static org.testng.Assert.assertNotEquals;
|
||||
|
||||
import io.swagger.codegen.options.AkkaScalaClientOptionsProvider;
|
||||
import io.swagger.codegen.options.AndroidClientOptionsProvider;
|
||||
import io.swagger.codegen.options.AsyncScalaClientOptionsProvider;
|
||||
import io.swagger.codegen.options.CSharpClientOptionsProvider;
|
||||
import io.swagger.codegen.options.CsharpDotNet2ClientOptionsProvider;
|
||||
import io.swagger.codegen.options.DartClientOptionsProvider;
|
||||
import io.swagger.codegen.options.FlashClienOptionsProvider;
|
||||
import io.swagger.codegen.options.JavaInflectorServerOptionsProvider;
|
||||
import io.swagger.codegen.options.JavaOptionsProvider;
|
||||
import io.swagger.codegen.options.JaxRSServerOptionsProvider;
|
||||
import io.swagger.codegen.options.NodeJSServerOptionsProvider;
|
||||
import io.swagger.codegen.options.ObjcClientOptionsProvider;
|
||||
import io.swagger.codegen.options.OptionsProvider;
|
||||
import io.swagger.codegen.options.PerlClientOptionsProvider;
|
||||
import io.swagger.codegen.options.PhpClientOptionsProvider;
|
||||
import io.swagger.codegen.options.PythonClientOptionsProvider;
|
||||
import io.swagger.codegen.options.Qt5CPPOptionsProvider;
|
||||
import io.swagger.codegen.options.RubyClientOptionsProvider;
|
||||
import io.swagger.codegen.options.ScalaClientOptionsProvider;
|
||||
import io.swagger.codegen.options.ScalatraServerOptionsProvider;
|
||||
import io.swagger.codegen.options.SilexServerOptionsProvider;
|
||||
import io.swagger.codegen.options.SinatraServerOptionsProvider;
|
||||
import io.swagger.codegen.options.SpringMVCServerOptionsProvider;
|
||||
import io.swagger.codegen.options.StaticDocOptionsProvider;
|
||||
import io.swagger.codegen.options.StaticHtmlOptionsProvider;
|
||||
import io.swagger.codegen.options.SwaggerOptionsProvider;
|
||||
import io.swagger.codegen.options.SwaggerYamlOptionsProvider;
|
||||
import io.swagger.codegen.options.SwiftOptionsProvider;
|
||||
import io.swagger.codegen.options.TizenClientOptionsProvider;
|
||||
import io.swagger.codegen.options.TypeScriptAngularClientOptionsProvider;
|
||||
import io.swagger.codegen.options.TypeScriptNodeClientOptionsProvider;
|
||||
import io.swagger.generator.exception.ApiException;
|
||||
import io.swagger.generator.model.GeneratorInput;
|
||||
import io.swagger.generator.online.Generator;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.testng.annotations.DataProvider;
|
||||
import org.testng.annotations.Test;
|
||||
|
||||
import java.io.File;
|
||||
@@ -19,19 +50,33 @@ import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
public abstract class OnlineGeneratorOptionsTest {
|
||||
private final boolean isServer;
|
||||
private final String language;
|
||||
public class OnlineGeneratorOptionsTest {
|
||||
private static final String OPTIONS_PROVIDER = "optionsProvider";
|
||||
|
||||
protected OnlineGeneratorOptionsTest(String language, boolean isServer) {
|
||||
this.language = language;
|
||||
this.isServer = isServer;
|
||||
@DataProvider(name = OPTIONS_PROVIDER)
|
||||
private Object[][] listOptions() {
|
||||
return new Object[][]{{new AkkaScalaClientOptionsProvider()}, {new AndroidClientOptionsProvider()},
|
||||
{new AsyncScalaClientOptionsProvider()}, {new CSharpClientOptionsProvider()},
|
||||
{new CsharpDotNet2ClientOptionsProvider()}, {new DartClientOptionsProvider()},
|
||||
{new FlashClienOptionsProvider()}, {new JavaInflectorServerOptionsProvider()},
|
||||
{new JavaOptionsProvider()}, {new JaxRSServerOptionsProvider()},
|
||||
{new NodeJSServerOptionsProvider()}, {new ObjcClientOptionsProvider()},
|
||||
{new PerlClientOptionsProvider()}, {new PhpClientOptionsProvider()},
|
||||
{new PythonClientOptionsProvider()}, {new Qt5CPPOptionsProvider()},
|
||||
{new RubyClientOptionsProvider()}, {new ScalaClientOptionsProvider()},
|
||||
{new ScalatraServerOptionsProvider()}, {new SilexServerOptionsProvider()},
|
||||
{new SinatraServerOptionsProvider()}, {new SpringMVCServerOptionsProvider()},
|
||||
{new StaticDocOptionsProvider()}, {new StaticHtmlOptionsProvider()},
|
||||
{new SwaggerOptionsProvider()}, {new SwaggerYamlOptionsProvider()},
|
||||
{new SwiftOptionsProvider()}, {new TizenClientOptionsProvider()},
|
||||
{new TypeScriptAngularClientOptionsProvider()}, {new TypeScriptNodeClientOptionsProvider()},
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void optionsTest() throws ApiException, IOException {
|
||||
@Test(dataProvider = OPTIONS_PROVIDER)
|
||||
public void optionsTest(OptionsProvider provider) throws ApiException, IOException {
|
||||
final GeneratorInput input = new GeneratorInput();
|
||||
final HashMap<String, InvocationCounter> options = convertOptions();
|
||||
final HashMap<String, InvocationCounter> options = convertOptions(provider);
|
||||
|
||||
final Maps.EntryTransformer<String, InvocationCounter, String> transformer =
|
||||
new Maps.EntryTransformer<String, InvocationCounter, String>() {
|
||||
@@ -44,10 +89,10 @@ public abstract class OnlineGeneratorOptionsTest {
|
||||
final ObjectMapper mapper = new ObjectMapper();
|
||||
input.setSpec(mapper.readTree(loadClassResource(getClass(), "petstore.json")));
|
||||
String outputFilename;
|
||||
if (isServer) {
|
||||
outputFilename = Generator.generateServer(language, input);
|
||||
if (provider.isServer()) {
|
||||
outputFilename = Generator.generateServer(provider.getLanguage(), input);
|
||||
} else {
|
||||
outputFilename = Generator.generateClient(language, input);
|
||||
outputFilename = Generator.generateClient(provider.getLanguage(), input);
|
||||
}
|
||||
final File dir = new File(new File(outputFilename).getParent());
|
||||
FileUtils.deleteDirectory(dir);
|
||||
@@ -57,11 +102,9 @@ public abstract class OnlineGeneratorOptionsTest {
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract Map<String, String> getOptions();
|
||||
|
||||
private HashMap<String, InvocationCounter> convertOptions() {
|
||||
private HashMap<String, InvocationCounter> convertOptions(OptionsProvider provider) {
|
||||
HashMap<String, InvocationCounter> options = new HashMap<String, InvocationCounter>();
|
||||
for (Map.Entry<String, String> entry : getOptions().entrySet()) {
|
||||
for (Map.Entry<String, String> entry : provider.createOptions().entrySet()) {
|
||||
options.put(entry.getKey(), new InvocationCounter(entry.getValue()));
|
||||
}
|
||||
return options;
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package io.swagger.generator.online;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class OnlineJavaClientOptionsTest extends OnlineGeneratorOptionsTest {
|
||||
|
||||
public OnlineJavaClientOptionsTest() {
|
||||
super("java", false);
|
||||
}
|
||||
|
||||
protected OnlineJavaClientOptionsTest(String language, boolean isServer) {
|
||||
super(language, isServer);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Map<String, String> getOptions() {
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
return builder.put("modelPackage", "package")
|
||||
.put("apiPackage", "apiPackage")
|
||||
.put("sortParamsByRequiredFlag", "false")
|
||||
.put("invokerPackage", "io.swagger.client.test")
|
||||
.put("groupId", "io.swagger.test")
|
||||
.put("artifactId", "swagger-java-client-test")
|
||||
.put("artifactVersion", "1.0.0-SNAPSHOT")
|
||||
.put("sourceFolder", "src/main/java/test")
|
||||
.put("localVariablePrefix", "tst")
|
||||
.put("serializableModel", "false")
|
||||
.put("fullJavaUtil", "true")
|
||||
.put("library", "jersey2")
|
||||
.build();
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
package io.swagger.generator.online;
|
||||
|
||||
public class OnlineJaxRSServerOptionsTest extends OnlineJavaClientOptionsTest{
|
||||
|
||||
public OnlineJaxRSServerOptionsTest() {
|
||||
super("jaxrs", true);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -43,8 +43,9 @@ import io.swagger.client.auth.HttpBasicAuth;
|
||||
import io.swagger.client.auth.ApiKeyAuth;
|
||||
import io.swagger.client.auth.OAuth;
|
||||
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-20T11:29:47.599-07:00")
|
||||
@javax.annotation.Generated(value = "class io.swagger.codegen.languages.JavaClientCodegen", date = "2015-10-29T09:31:27.804+08:00")
|
||||
public class ApiClient {
|
||||
private Client client;
|
||||
private Map<String, Client> hostMap = new HashMap<String, Client>();
|
||||
private Map<String, String> defaultHeaderMap = new HashMap<String, String>();
|
||||
private boolean debugging = false;
|
||||
@@ -69,10 +70,12 @@ public class ApiClient {
|
||||
// Set default User-Agent.
|
||||
setUserAgent("Java-Swagger");
|
||||
|
||||
buildClient();
|
||||
|
||||
// Setup authentications (key: authentication name, value: authentication).
|
||||
authentications = new HashMap<String, Authentication>();
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
authentications.put("petstore_auth", new OAuth());
|
||||
authentications.put("api_key", new ApiKeyAuth("header", "api_key"));
|
||||
// Prevent the authentications from being modified.
|
||||
authentications = Collections.unmodifiableMap(authentications);
|
||||
}
|
||||
@@ -202,6 +205,7 @@ public class ApiClient {
|
||||
*/
|
||||
public ApiClient setDebugging(boolean debugging) {
|
||||
this.debugging = debugging;
|
||||
buildClient();
|
||||
return this;
|
||||
}
|
||||
|
||||
@@ -418,13 +422,6 @@ public class ApiClient {
|
||||
public <T> T invokeAPI(String path, String method, List<Pair> queryParams, Object body, Map<String, String> headerParams, Map<String, Object> formParams, String accept, String contentType, String[] authNames, TypeRef returnType) throws ApiException {
|
||||
updateParamsForAuth(authNames, queryParams, headerParams);
|
||||
|
||||
final ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.register(MultiPartFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
}
|
||||
Client client = ClientBuilder.newClient(clientConfig);
|
||||
|
||||
WebTarget target = client.target(this.basePath).path(path);
|
||||
|
||||
if (queryParams != null) {
|
||||
@@ -536,6 +533,15 @@ public class ApiClient {
|
||||
}
|
||||
}
|
||||
|
||||
private void buildClient() {
|
||||
final ClientConfig clientConfig = new ClientConfig();
|
||||
clientConfig.register(MultiPartFeature.class);
|
||||
if (debugging) {
|
||||
clientConfig.register(LoggingFilter.class);
|
||||
}
|
||||
this.client = ClientBuilder.newClient(clientConfig);
|
||||
}
|
||||
|
||||
private Map<String, List<String>> buildResponseHeaders(Response response) {
|
||||
Map<String, List<String>> responseHeaders = new HashMap<String, List<String>>();
|
||||
for (Entry<String, List<Object>> entry: response.getHeaders().entrySet()) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 33;
|
||||
use Test::More tests => 35;
|
||||
use Test::Exception;
|
||||
|
||||
use lib 'lib';
|
||||
@@ -59,6 +59,9 @@ is $get_pet_hash->{category}->{id}, '22', 'get the proper category id from get_p
|
||||
is $get_pet_hash->{category}->{name}, 'perl', 'get the proper category from get_pet_by_id';
|
||||
is $get_pet_hash->{tags}[0]->{name}, 'just kidding', 'get the proper tag from get_pet_by_id';
|
||||
is $get_pet_hash->{tags}[0]->{id}, '11', 'get the proper tag id from get_pet_by_id';
|
||||
is $get_pet_hash->{photoUrls}->[0], '123', 'get the proper photoUrl from get_pet_by_id';
|
||||
is $get_pet_hash->{photoUrls}->[1], 'oop', 'get the proper photoUrl from get_pet_by_id';
|
||||
|
||||
|
||||
my $update_pet_with_form = $api->update_pet_with_form(pet_id => $pet_id, name => 'test_name', status => 'sold');
|
||||
is $update_pet_with_form, undef, 'get the null response from update_pet_wth_form';
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
use Test::More tests => 22;
|
||||
use Test::More tests => 42;
|
||||
use Test::Exception;
|
||||
|
||||
use lib 'lib';
|
||||
@@ -12,6 +12,8 @@ use_ok('WWW::SwaggerClient::ApiClient');
|
||||
use_ok('WWW::SwaggerClient::Object::Pet');
|
||||
use_ok('WWW::SwaggerClient::Object::Tag');
|
||||
use_ok('WWW::SwaggerClient::Object::Category');
|
||||
use_ok('WWW::SwaggerClient::Object::User');
|
||||
|
||||
|
||||
my $api_client = WWW::SwaggerClient::ApiClient->new();
|
||||
my $store_api = WWW::SwaggerClient::StoreApi->new('api_client' => $api_client);
|
||||
@@ -53,6 +55,7 @@ is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{category}->{
|
||||
is ref $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
|
||||
is ref $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{tags}[0], "WWW::SwaggerClient::Object::Tag", "get the Tag of the Pet object";
|
||||
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{tags}[0]->{name}, "tag string", "get the Tag name of the Pet object";
|
||||
is $api_client->deserialize("HASH[string,Pet]", $pet_json)->{pet}->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
|
||||
|
||||
my $array_json = <<JSON;
|
||||
[
|
||||
@@ -84,5 +87,59 @@ is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{category}->{name},
|
||||
is ref $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
|
||||
is ref $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{tags}->[0], "WWW::SwaggerClient::Object::Tag", "get the Tag[0] the Pet object";
|
||||
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{tags}->[0]->{name}, "tag string", "get the tag name the Pet object";
|
||||
is $api_client->deserialize("ARRAY[Pet]", $array_json)->[0]->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
|
||||
|
||||
my $pet_json_nopet = <<JSON;
|
||||
{
|
||||
"id": 0,
|
||||
"category": {
|
||||
"id": 0,
|
||||
"name": "string"
|
||||
},
|
||||
"name": "doggie",
|
||||
"photoUrls": [
|
||||
"string"
|
||||
],
|
||||
"tags": [
|
||||
{
|
||||
"id": 0,
|
||||
"name": "tag string"
|
||||
}
|
||||
],
|
||||
"status": "available"
|
||||
}
|
||||
JSON
|
||||
|
||||
is ref(decode_json $pet_json_nopet), "HASH", "the decoded json string is a hash";
|
||||
is ref $api_client->deserialize("Pet", $pet_json_nopet), "WWW::SwaggerClient::Object::Pet", "get Pet object via from_hash()";
|
||||
is $api_client->deserialize("Pet", $pet_json_nopet)->{name}, "doggie", "get the name of the Pet object";
|
||||
is $api_client->deserialize("Pet", $pet_json_nopet)->{category}->{name}, "string", "get the category name of the Pet object";
|
||||
is ref $api_client->deserialize("Pet", $pet_json_nopet)->{category}, "WWW::SwaggerClient::Object::Category", "get the Category the Pet object";
|
||||
is ref $api_client->deserialize("Pet", $pet_json_nopet)->{tags}->[0], "WWW::SwaggerClient::Object::Tag", "get the Tag[0] the Pet object";
|
||||
is $api_client->deserialize("Pet", $pet_json_nopet)->{tags}->[0]->{name}, "tag string", "get the tag name the Pet object";
|
||||
is $api_client->deserialize("Pet", $pet_json_nopet)->{photo_urls}->[0], "string", "get the photoUrl from the Pet object";
|
||||
|
||||
|
||||
my %userdata = (
|
||||
id => 4000,
|
||||
username => "tony",
|
||||
firstName => "Tony",
|
||||
lastName => "Tiger",
|
||||
email => 'tony@fail.com',
|
||||
password => "XXXXXXXXXXX",
|
||||
phone => "408-867-5309",
|
||||
userStatus => 1,
|
||||
);
|
||||
|
||||
my $user = WWW::SwaggerClient::Object::User->new->from_hash(\%userdata);
|
||||
is ref $user, 'WWW::SwaggerClient::Object::User', "built a User object via from_hash()";
|
||||
is $user->{id}, $userdata{id}, "got the id of the User object";
|
||||
is $user->{username}, $userdata{username}, "got the username of the User object";
|
||||
is $user->{first_name}, $userdata{firstName}, "got the firstName of the User object";
|
||||
is $user->{last_name}, $userdata{lastName}, "got the lastName of the User object";
|
||||
is $user->{email}, $userdata{email}, "got the email of the User object";
|
||||
is $user->{password}, $userdata{password}, "got the password of the User object";
|
||||
is $user->{phone}, $userdata{phone}, "got the phone of the User object";
|
||||
is $user->{user_status}, $userdata{userStatus}, "got the userStatus of the User object";
|
||||
|
||||
|
||||
|
||||
@@ -136,7 +136,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -201,7 +201,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -265,7 +265,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -341,7 +341,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -527,7 +527,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -603,7 +603,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
@@ -695,7 +695,7 @@ class PetApi
|
||||
}
|
||||
|
||||
|
||||
//TODO support oauth
|
||||
$headerParams['Authorization'] = 'Bearer ' . $this->apiClient->getConfig()->getAccessToken();
|
||||
|
||||
// make the API Call
|
||||
try
|
||||
|
||||
@@ -63,6 +63,13 @@ class Configuration
|
||||
*/
|
||||
protected $apiKeyPrefixes = array();
|
||||
|
||||
/**
|
||||
* Access token for OAuth
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $accessToken = '';
|
||||
|
||||
/**
|
||||
* Username for HTTP basic authentication
|
||||
*
|
||||
@@ -195,6 +202,29 @@ class Configuration
|
||||
return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the access token for OAuth
|
||||
*
|
||||
* @param string $accessToken Token for OAuth
|
||||
*
|
||||
* @return Configuration
|
||||
*/
|
||||
public function setAccessToken($accessToken)
|
||||
{
|
||||
$this->$accessToken = $accessToken;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the access token for OAuth
|
||||
*
|
||||
* @return string Access token for OAuth
|
||||
*/
|
||||
public function getAccessToken()
|
||||
{
|
||||
return $this->accessToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the username for HTTP basic authentication
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user