mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-12-06 09:26:13 +00:00
Merge remote-tracking branch 'origin/4.1.x' into sync_41x_50x
This commit is contained in:
@@ -3,7 +3,9 @@
|
||||
<parent>
|
||||
<groupId>org.openapitools</groupId>
|
||||
<artifactId>openapi-generator-project</artifactId>
|
||||
<!-- RELEASE_VERSION -->
|
||||
<version>5.0.0-SNAPSHOT</version>
|
||||
<!-- /RELEASE_VERSION -->
|
||||
<relativePath>../..</relativePath>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@@ -140,7 +140,7 @@ public class Generate implements Runnable {
|
||||
private List<String> typeMappings = new ArrayList<>();
|
||||
|
||||
@Option(
|
||||
name = {"--additional-properties"},
|
||||
name = {"-p", "--additional-properties"},
|
||||
title = "additional properties",
|
||||
description = "sets additional properties that can be referenced by the mustache templates in the format of name=value,name=value."
|
||||
+ " You can also have multiple occurrences of this option.")
|
||||
@@ -383,7 +383,10 @@ public class Generate implements Runnable {
|
||||
configurator.setStrictSpecBehavior(strictSpecBehavior);
|
||||
}
|
||||
|
||||
applySystemPropertiesKvpList(systemProperties, configurator);
|
||||
if (systemProperties != null && !systemProperties.isEmpty()) {
|
||||
System.err.println("[DEPRECATED] -D arguments after 'generate' are application arguments and not Java System Properties, please consider changing to -p, or apply your options to JAVA_OPTS, or move the -D arguments before the jar option.");
|
||||
applySystemPropertiesKvpList(systemProperties, configurator);
|
||||
}
|
||||
applyInstantiationTypesKvpList(instantiationTypes, configurator);
|
||||
applyImportMappingsKvpList(importMappings, configurator);
|
||||
applyTypeMappingsKvpList(typeMappings, configurator);
|
||||
|
||||
@@ -64,9 +64,11 @@ public class GenerateTest {
|
||||
|
||||
@Test
|
||||
public void testRequiredArgs_ShortArgs() throws Exception {
|
||||
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null);
|
||||
setupAndRunTest("-i", "src/test/resources/swagger.yaml", "-g", "java", "-o", "src/main/java", false, null, "-p", "foo=bar");
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addAdditionalProperty("foo", "bar");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -138,85 +140,6 @@ public class GenerateTest {
|
||||
};
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testSystemProperties() throws Exception {
|
||||
|
||||
setupAndRunGenericTest("-D", "hello=world,foo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
|
||||
setupAndRunGenericTest("-Dhello=world,foo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
|
||||
setupAndRunGenericTest("-D", "hello=world,key=,foo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("key", "");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
|
||||
setupAndRunGenericTest("-D", "hello=world,key,foo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("key", "");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
|
||||
setupAndRunGenericTest("-D", "hello=world", "-D", "key", "-D", "foo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("key", "");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
|
||||
setupAndRunGenericTest("-Dhello=world", "-Dkey", "-Dfoo=bar");
|
||||
|
||||
new FullVerifications() {
|
||||
{
|
||||
configurator.addSystemProperty("hello", "world");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("foo", "bar");
|
||||
times = 1;
|
||||
configurator.addSystemProperty("key", "");
|
||||
times = 1;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testConfigJson() throws Exception {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user