forked from loafle/openapi-generator-original
fix merge conflict
This commit is contained in:
@@ -77,6 +77,40 @@ public class InlineModelResolverTest {
|
||||
assertTrue(model.getProperties().get("name") instanceof StringProperty);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testInlineResponseModelWithTitle() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
String responseTitle = "GetBarResponse";
|
||||
swagger.path("/foo/bar", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.description("it works!")
|
||||
.schema(new ObjectProperty().title(responseTitle)
|
||||
.property("name", new StringProperty())))))
|
||||
.path("/foo/baz", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.vendorExtension("x-foo", "bar")
|
||||
.description("it works!")
|
||||
.schema(new ObjectProperty()
|
||||
.property("name", new StringProperty())))));
|
||||
new InlineModelResolver().flatten(swagger);
|
||||
|
||||
Map<String, Response> responses = swagger.getPaths().get("/foo/bar").getGet().getResponses();
|
||||
|
||||
Response response = responses.get("200");
|
||||
assertNotNull(response);
|
||||
assertTrue(response.getSchema() instanceof RefProperty);
|
||||
|
||||
ModelImpl model = (ModelImpl)swagger.getDefinitions().get(responseTitle);
|
||||
assertTrue(model.getProperties().size() == 1);
|
||||
assertNotNull(model.getProperties().get("name"));
|
||||
assertTrue(model.getProperties().get("name") instanceof StringProperty);
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void resolveInlineArrayModel() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
@@ -128,6 +162,35 @@ public class InlineModelResolverTest {
|
||||
ModelImpl impl = (ModelImpl) body;
|
||||
assertNotNull(impl.getProperties().get("address"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveInlineBodyParameterWithTitle() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
ModelImpl addressModelItem = new ModelImpl();
|
||||
String addressModelName = "DetailedAddress";
|
||||
addressModelItem.setTitle(addressModelName);
|
||||
swagger.path("/hello", new Path()
|
||||
.get(new Operation()
|
||||
.parameter(new BodyParameter()
|
||||
.name("body")
|
||||
.schema(addressModelItem
|
||||
.property("address", new ObjectProperty()
|
||||
.property("street", new StringProperty()))
|
||||
.property("name", new StringProperty())))));
|
||||
|
||||
new InlineModelResolver().flatten(swagger);
|
||||
|
||||
Operation operation = swagger.getPaths().get("/hello").getGet();
|
||||
BodyParameter bp = (BodyParameter)operation.getParameters().get(0);
|
||||
assertTrue(bp.getSchema() instanceof RefModel);
|
||||
|
||||
Model body = swagger.getDefinitions().get(addressModelName);
|
||||
assertTrue(body instanceof ModelImpl);
|
||||
|
||||
ModelImpl impl = (ModelImpl) body;
|
||||
assertNotNull(impl.getProperties().get("address"));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void notResolveNonModelBodyParameter() throws Exception {
|
||||
@@ -245,6 +308,50 @@ public class InlineModelResolverTest {
|
||||
assertTrue(impl.getProperties().get("name") instanceof StringProperty);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void resolveInlineArrayResponseWithTitle() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
swagger.path("/foo/baz", new Path()
|
||||
.get(new Operation()
|
||||
.response(200, new Response()
|
||||
.vendorExtension("x-foo", "bar")
|
||||
.description("it works!")
|
||||
.schema(new ArrayProperty()
|
||||
.items(
|
||||
new ObjectProperty()
|
||||
.title("FooBar")
|
||||
.property("name", new StringProperty()))))));
|
||||
|
||||
new InlineModelResolver().flatten(swagger);
|
||||
|
||||
Response response = swagger.getPaths().get("/foo/baz").getGet().getResponses().get("200");
|
||||
assertNotNull(response);
|
||||
|
||||
assertNotNull(response.getSchema());
|
||||
Property responseProperty = response.getSchema();
|
||||
|
||||
// no need to flatten more
|
||||
assertTrue(responseProperty instanceof ArrayProperty);
|
||||
|
||||
ArrayProperty ap = (ArrayProperty) responseProperty;
|
||||
Property p = ap.getItems();
|
||||
|
||||
assertNotNull(p);
|
||||
|
||||
RefProperty rp = (RefProperty) p;
|
||||
assertEquals(rp.getType(), "ref");
|
||||
assertEquals(rp.get$ref(), "#/definitions/"+ "FooBar");
|
||||
assertEquals(rp.getSimpleRef(), "FooBar");
|
||||
|
||||
Model inline = swagger.getDefinitions().get("FooBar");
|
||||
assertNotNull(inline);
|
||||
assertTrue(inline instanceof ModelImpl);
|
||||
ModelImpl impl = (ModelImpl) inline;
|
||||
assertNotNull(impl.getProperties().get("name"));
|
||||
assertTrue(impl.getProperties().get("name") instanceof StringProperty);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testInlineMapResponse() throws Exception {
|
||||
Swagger swagger = new Swagger();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.swagger.codegen.Go;
|
||||
package io.swagger.codegen.go;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
@@ -29,7 +29,7 @@ public class GoClientOptionsTest extends AbstractOptionsTest {
|
||||
clientCodegen.setPackageVersion(GoClientOptionsProvider.PACKAGE_VERSION_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setPackageName(GoClientOptionsProvider.PACKAGE_NAME_VALUE);
|
||||
times = 1;
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.swagger.codegen.Go;
|
||||
package io.swagger.codegen.go;
|
||||
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
|
||||
@@ -1,21 +1,152 @@
|
||||
package io.swagger.codegen.ignore;
|
||||
|
||||
import org.testng.annotations.Test;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.testng.annotations.*;
|
||||
import static org.testng.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Path;
|
||||
|
||||
public class CodegenIgnoreProcessorTest {
|
||||
@Test
|
||||
public void loadCodegenRules() throws Exception {
|
||||
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(CodegenIgnoreProcessorTest.class);
|
||||
|
||||
private Boolean allowed;
|
||||
private Boolean skip = false;
|
||||
private final String filename;
|
||||
private final String ignoreDefinition;
|
||||
private final String description;
|
||||
private String outputDir;
|
||||
private File target;
|
||||
private Path temp;
|
||||
|
||||
private CodegenIgnoreProcessorTest(String filename, String ignoreDefinition, String description) throws IOException {
|
||||
this.filename = filename;
|
||||
this.ignoreDefinition = ignoreDefinition;
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
CodegenIgnoreProcessorTest allowed() {
|
||||
this.allowed = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
CodegenIgnoreProcessorTest skipOnCondition(Boolean condition) {
|
||||
this.skip = Boolean.TRUE.equals(condition);
|
||||
return this;
|
||||
}
|
||||
|
||||
CodegenIgnoreProcessorTest ignored() {
|
||||
this.allowed = false;
|
||||
return this;
|
||||
}
|
||||
|
||||
private void prepareTestFiles() throws IOException {
|
||||
// NOTE: Each test needs its own directory because .swagger-codegen-ignore needs to exist at the root.
|
||||
temp = Files.createTempDirectory(getClass().getSimpleName());
|
||||
this.outputDir = temp.toFile().getAbsolutePath();
|
||||
|
||||
target = new File(this.outputDir, this.filename);
|
||||
|
||||
boolean mkdirs = target.getParentFile().mkdirs();
|
||||
if(!mkdirs) {
|
||||
LOGGER.warn("Failed to create directories for CodegenIgnoreProcessorTest test file. Directory may already exist.");
|
||||
}
|
||||
|
||||
Path created = Files.createFile(target.toPath());
|
||||
if(!created.toFile().exists()) {
|
||||
throw new IOException("Failed to write CodegenIgnoreProcessorTest test file.");
|
||||
}
|
||||
|
||||
// System.out.print(String.format("Created codegen ignore processor test file: %s\n", created.toAbsolutePath()));
|
||||
File ignoreFile = new File(this.outputDir, ".swagger-codegen-ignore");
|
||||
try (FileOutputStream stream = new FileOutputStream(ignoreFile)) {
|
||||
stream.write(this.ignoreDefinition.getBytes());
|
||||
}
|
||||
}
|
||||
|
||||
@AfterTest
|
||||
public void afterTest() throws IOException {
|
||||
if(temp != null && temp.toFile().exists() && temp.toFile().isDirectory()) {
|
||||
FileUtils.deleteDirectory(temp.toFile());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getInclusionRules() throws Exception {
|
||||
public void evaluate() {
|
||||
if(this.skip) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Arrange
|
||||
try {
|
||||
// Lazily setup files to avoid conflicts and creation when these tests may not even run.
|
||||
prepareTestFiles();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
fail("Failed to prepare test files. " + e.getMessage());
|
||||
}
|
||||
CodegenIgnoreProcessor processor = new CodegenIgnoreProcessor(outputDir);
|
||||
Boolean actual = null;
|
||||
|
||||
// Act
|
||||
actual = processor.allowsFile(target);
|
||||
|
||||
// Assert
|
||||
assertEquals(actual, this.allowed, this.description);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getExclusionRules() throws Exception {
|
||||
@Factory
|
||||
public static Object[] factoryMethod() throws IOException {
|
||||
return new Object[] {
|
||||
// Matching filenames
|
||||
new CodegenIgnoreProcessorTest("build.sh", "build.sh", "A file when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("src/build.sh", "**/build.sh", "A file when matching nested files should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("Build.sh", "build.sh", "A file when non-matching should allow.").allowed().skipOnCondition(SystemUtils.IS_OS_WINDOWS),
|
||||
new CodegenIgnoreProcessorTest("build.sh", "/build.sh", "A rooted file when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("nested/build.sh", "/build.sh", "A rooted file definition when non-matching should allow.").allowed(),
|
||||
new CodegenIgnoreProcessorTest("src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "src/IO.Swagger.Test/Model/AnimalFarmTests.cs", "A file when matching exactly should ignore.").ignored(),
|
||||
|
||||
// Matching spaces in filenames
|
||||
new CodegenIgnoreProcessorTest("src/properly escaped.txt", "**/properly escaped.txt", "A file when matching nested files with spaces in the name should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("src/improperly escaped.txt", "**/improperly\\ escaped.txt", "A file when matching nested files with spaces in the name (improperly escaped rule) should allow.").allowed(),
|
||||
|
||||
// Match All
|
||||
new CodegenIgnoreProcessorTest("docs/somefile.md", "docs/**", "A recursive file (0 level) when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/somefile.md", "docs/**", "A recursive file (1 level) when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/somefile.md", "docs/**", "A recursive file (n level) when matching should ignore.").ignored(),
|
||||
|
||||
// Match Any
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/somefile.md", "docs/**/somefile.*", "A recursive file with match-any extension when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/somefile.java", "docs/**/*.java", "A recursive file with match-any file name when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/4/somefile.md", "docs/**/*", "A recursive file with match-any file name when matching should ignore.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/4/5/somefile.md", "docs/**/anyfile.*", "A recursive file with match-any extension when non-matching should allow.").allowed(),
|
||||
|
||||
// Directory matches
|
||||
new CodegenIgnoreProcessorTest("docs/1/Users/a", "docs/**/Users/", "A directory rule when matching should be ignored.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/Users1/a", "docs/**/Users/", "A directory rule when non-matching should be allowed.").allowed(),
|
||||
|
||||
// Negation of excluded recursive files
|
||||
new CodegenIgnoreProcessorTest("docs/UserApi.md", "docs/**\n!docs/UserApi.md", "A pattern negating a previous ignore FILE rule should be allowed.").allowed(),
|
||||
|
||||
// Negation of excluded directories
|
||||
new CodegenIgnoreProcessorTest("docs/1/Users/UserApi.md", "docs/**/Users/\n!docs/1/Users/UserApi.md", "A pattern negating a previous ignore DIRECTORY rule should be ignored.").ignored(),
|
||||
|
||||
// Other matches which may not be parsed for correctness, but are free because of PathMatcher
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/Some99File.md", "**/*[0-9]*", "A file when matching against simple regex patterns when matching should be ignored.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/SomeFile.md", "**/*.{java,md}", "A file when matching against grouped subpatterns for extension when matching (md) should be ignored.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/SomeFile.java", "**/*.{java,md}", "A file when matching against grouped subpatterns for extension when matching (java) should be ignored.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/SomeFile.txt", "**/*.{java,md}", "A file when matching against grouped subpatterns for extension when non-matching should be allowed.").allowed(),
|
||||
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/foo.c", "**/*.?", "A file when matching against required single-character extension when matching should be ignored.").ignored(),
|
||||
new CodegenIgnoreProcessorTest("docs/1/2/3/foo.cc", "**/*.?", "A file when matching against required single-character extension when non-matching should be allowed.").allowed()
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import java.nio.charset.StandardCharsets;
|
||||
|
||||
public class AllowableValuesTest {
|
||||
|
||||
private static final String TEMPLATE_FILE = "JavaJaxRS/jersey1_18/allowableValues.mustache";
|
||||
private static final String TEMPLATE_FILE = "JavaJaxRS/libraries/jersey1/allowableValues.mustache";
|
||||
private static final String PROVIDER_NAME = "operations";
|
||||
|
||||
private static String loadClassResource(Class<?> cls, String name) throws IOException {
|
||||
|
||||
@@ -46,7 +46,8 @@ public class JaxRSServerOptionsTest extends JavaClientOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setSerializableModel(Boolean.valueOf(JaxRSServerOptionsProvider.SERIALIZABLE_MODEL_VALUE));
|
||||
times = 1;
|
||||
clientCodegen.setLibrary(JaxRSServerOptionsProvider.DEFAULT_LIBRARY_VALUE);
|
||||
//clientCodegen.setLibrary(JaxRSServerOptionsProvider.JAXRS_LIBRARY_VALUE);
|
||||
clientCodegen.setLibrary("jersey1");
|
||||
times = 1;
|
||||
clientCodegen.setFullJavaUtil(Boolean.valueOf(JaxRSServerOptionsProvider.FULL_JAVA_UTIL_VALUE));
|
||||
times = 1;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.swagger.codegen.slim;
|
||||
package io.swagger.codegen.lumen;
|
||||
|
||||
import io.swagger.codegen.AbstractOptionsTest;
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
|
||||
@@ -38,8 +38,6 @@ public class ObjcClientOptionsTest extends AbstractOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setGitRepoURL(ObjcClientOptionsProvider.GIT_REPO_URL_VALUE);
|
||||
times = 1;
|
||||
clientCodegen.setLicense(ObjcClientOptionsProvider.LICENSE_VALUE);
|
||||
times = 1;
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,21 +1,9 @@
|
||||
package io.swagger.codegen.objc;
|
||||
|
||||
import io.swagger.codegen.CodegenModel;
|
||||
import io.swagger.codegen.CodegenOperation;
|
||||
import io.swagger.codegen.CodegenProperty;
|
||||
import io.swagger.codegen.DefaultCodegen;
|
||||
import io.swagger.codegen.*;
|
||||
import io.swagger.codegen.languages.ObjcClientCodegen;
|
||||
import io.swagger.models.ArrayModel;
|
||||
import io.swagger.models.Model;
|
||||
import io.swagger.models.ModelImpl;
|
||||
import io.swagger.models.Path;
|
||||
import io.swagger.models.Swagger;
|
||||
import io.swagger.models.properties.ArrayProperty;
|
||||
import io.swagger.models.properties.DateTimeProperty;
|
||||
import io.swagger.models.properties.LongProperty;
|
||||
import io.swagger.models.properties.MapProperty;
|
||||
import io.swagger.models.properties.RefProperty;
|
||||
import io.swagger.models.properties.StringProperty;
|
||||
import io.swagger.models.*;
|
||||
import io.swagger.models.properties.*;
|
||||
import io.swagger.parser.SwaggerParser;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
@@ -279,6 +267,20 @@ public class ObjcModelTest {
|
||||
Assert.assertEquals(Sets.intersection(cm.imports, Sets.newHashSet("SWGChildren")).size(), 1);
|
||||
}
|
||||
|
||||
@Test(description = "test binary data")
|
||||
public void binaryDataModelTest() {
|
||||
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/binaryDataTest.json");
|
||||
final DefaultCodegen codegen = new ObjcClientCodegen();
|
||||
final String path = "/tests/binaryResponse";
|
||||
final Operation p = model.getPaths().get(path).getPost();
|
||||
final CodegenOperation op = codegen.fromOperation(path, "post", p, model.getDefinitions());
|
||||
|
||||
Assert.assertEquals(op.returnType, "NSData*");
|
||||
Assert.assertEquals(op.bodyParam.dataType, "NSData*");
|
||||
Assert.assertTrue(op.bodyParam.isBinary);
|
||||
Assert.assertTrue(op.responses.get(0).isBinary);
|
||||
}
|
||||
|
||||
@Test(description = "create proper imports per #316")
|
||||
public void issue316Test() {
|
||||
final Swagger model = new SwaggerParser().read("src/test/resources/2_0/postBodyTest.json");
|
||||
|
||||
@@ -2,12 +2,27 @@ package io.swagger.codegen.options;
|
||||
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import io.swagger.codegen.CodegenConstants;
|
||||
import io.swagger.codegen.languages.JavaClientCodegen;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class JaxRSServerOptionsProvider extends JavaOptionsProvider {
|
||||
public class JaxRSServerOptionsProvider 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 DEFAULT_LIBRARY_VALUE = "jersey2";
|
||||
public static final String SERIALIZABLE_MODEL_VALUE = "false";
|
||||
public static final String FULL_JAVA_UTIL_VALUE = "true";
|
||||
public static final String ENSURE_UNIQUE_PARAMS_VALUE = "true";
|
||||
public static final String JODA_DATE_LIBRARY = "joda";
|
||||
public static final String IMPL_FOLDER_VALUE = "src/main/java/impl";
|
||||
public static final String IMPL_FOLDER_VALUE = "src/main/java/impl";
|
||||
public static final String JAXRS_DEFAULT_LIBRARY_VALUE = "jersey1";
|
||||
|
||||
@Override
|
||||
public boolean isServer() {
|
||||
@@ -21,13 +36,27 @@ public class JaxRSServerOptionsProvider extends JavaOptionsProvider {
|
||||
|
||||
@Override
|
||||
public Map<String, String> createOptions() {
|
||||
Map<String, String> options = super.createOptions();
|
||||
|
||||
ImmutableMap.Builder<String, String> builder = new ImmutableMap.Builder<String, String>();
|
||||
builder.putAll(options)
|
||||
.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
|
||||
//.put(JavaJaxRSJersey1ServerCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
|
||||
.put("title", "Test title");
|
||||
builder.put(CodegenConstants.IMPL_FOLDER, IMPL_FOLDER_VALUE)
|
||||
.put(JavaClientCodegen.DATE_LIBRARY, "joda") //java.lang.IllegalArgumentException: Multiple entries with same key: dateLibrary=joda and dateLibrary=joda
|
||||
.put("title", "Test title")
|
||||
.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.ENSURE_UNIQUE_PARAMS, ENSURE_UNIQUE_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, JAXRS_DEFAULT_LIBRARY_VALUE)
|
||||
.put(CodegenConstants.SERIALIZE_BIG_DECIMAL_AS_STRING, "true")
|
||||
.put(JavaClientCodegen.USE_RX_JAVA, "false")
|
||||
//.put(JavaClientCodegen.DATE_LIBRARY, "joda")
|
||||
.put("hideGenerationTimestamp", "true");
|
||||
|
||||
return builder.build();
|
||||
}
|
||||
|
||||
@@ -9,12 +9,12 @@ import java.util.Map;
|
||||
|
||||
public class ObjcClientOptionsProvider implements OptionsProvider {
|
||||
public static final String CLASS_PREFIX_VALUE = "SWGObjc";
|
||||
public static final String CORE_DATA_VALUE = "n";
|
||||
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() {
|
||||
@@ -30,7 +30,7 @@ public class ObjcClientOptionsProvider implements OptionsProvider {
|
||||
.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)
|
||||
.put(ObjcClientCodegen.CORE_DATA, CORE_DATA_VALUE)
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider {
|
||||
public static final String CONFIG_PACKAGE_VALUE = "configPackage";
|
||||
public static final String BASE_PACKAGE_VALUE = "basePackage";
|
||||
public static final String LIBRARY_VALUE = "j8-async"; //FIXME hidding value from super class
|
||||
public static final String INTERFACE_ONLY = "true";
|
||||
public static final String SINGLE_CONTENT_TYPES = "true";
|
||||
|
||||
@Override
|
||||
public String getLanguage() {
|
||||
@@ -22,6 +24,9 @@ public class SpringBootServerOptionsProvider extends JavaOptionsProvider {
|
||||
options.put(SpringBootServerCodegen.CONFIG_PACKAGE, CONFIG_PACKAGE_VALUE);
|
||||
options.put(SpringBootServerCodegen.BASE_PACKAGE, BASE_PACKAGE_VALUE);
|
||||
options.put(CodegenConstants.LIBRARY, LIBRARY_VALUE);
|
||||
options.put(SpringBootServerCodegen.INTERFACE_ONLY, INTERFACE_ONLY);
|
||||
options.put(SpringBootServerCodegen.SINGLE_CONTENT_TYPES, SINGLE_CONTENT_TYPES);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package io.swagger.codegen.springBoot;
|
||||
package io.swagger.codegen.springboot;
|
||||
|
||||
import io.swagger.codegen.CodegenConfig;
|
||||
import io.swagger.codegen.java.JavaClientOptionsTest;
|
||||
@@ -54,7 +54,11 @@ public class SpringBootServerOptionsTest extends JavaClientOptionsTest {
|
||||
times = 1;
|
||||
clientCodegen.setBasePackage(SpringBootServerOptionsProvider.BASE_PACKAGE_VALUE);
|
||||
times = 1;
|
||||
|
||||
clientCodegen.setInterfaceOnly(Boolean.valueOf(SpringBootServerOptionsProvider.INTERFACE_ONLY));
|
||||
times = 1;
|
||||
clientCodegen.setSingleContentTypes(Boolean.valueOf(SpringBootServerOptionsProvider.SINGLE_CONTENT_TYPES));
|
||||
times = 1;
|
||||
|
||||
}};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user