forked from loafle/openapi-generator-original
boolean values from JSON are treated as strings (#4229)
* Change the value types in additionalProperties and dynamicProperties to Object instead of String. Change methods that insert values to these maps to use Object as the type of the value instead of String. * Fix run-all-petstore run: use toString instead of casting
This commit is contained in:
@@ -156,12 +156,16 @@ public class CodegenConfiguratorTest {
|
||||
public void testAdditionalProperties() throws Exception {
|
||||
|
||||
configurator.addAdditionalProperty("foo", "bar")
|
||||
.addAdditionalProperty("hello", "world");
|
||||
.addAdditionalProperty("hello", "world")
|
||||
.addAdditionalProperty("supportJava6", false)
|
||||
.addAdditionalProperty("useRxJava", true);
|
||||
|
||||
final ClientOptInput clientOptInput = setupAndRunGenericTest(configurator);
|
||||
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "foo", "bar");
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "hello", "world");
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "supportJava6", false);
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "useRxJava", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -241,10 +245,14 @@ public class CodegenConfiguratorTest {
|
||||
@Test
|
||||
public void testDynamicProperties() throws Exception {
|
||||
configurator.addDynamicProperty(CodegenConstants.LOCAL_VARIABLE_PREFIX, "_");
|
||||
configurator.addDynamicProperty("supportJava6", false);
|
||||
configurator.addDynamicProperty("useRxJava", true);
|
||||
|
||||
final ClientOptInput clientOptInput = setupAndRunGenericTest(configurator);
|
||||
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), CodegenConstants.LOCAL_VARIABLE_PREFIX, "_");
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "supportJava6", false);
|
||||
assertValueInMap(clientOptInput.getConfig().additionalProperties(), "useRxJava", true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -344,7 +352,7 @@ public class CodegenConfiguratorTest {
|
||||
}};
|
||||
}
|
||||
|
||||
private static void assertValueInMap(Map<?, ?> map, String propertyKey, String expectedPropertyValue) {
|
||||
private static void assertValueInMap(Map<?, ?> map, String propertyKey, Object expectedPropertyValue) {
|
||||
assertTrue(map.containsKey(propertyKey));
|
||||
assertEquals(map.get(propertyKey), expectedPropertyValue);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user