mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-30 13:30:52 +00:00
Deal with boolean field (#18294)
This commit is contained in:
parent
83b45fd1e8
commit
45a657f59d
@ -753,6 +753,9 @@ public class PostmanCollectionCodegen extends DefaultCodegen implements CodegenC
|
|||||||
} else if (value instanceof Integer) {
|
} else if (value instanceof Integer) {
|
||||||
ret = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": " +
|
ret = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": " +
|
||||||
value;
|
value;
|
||||||
|
} else if (value instanceof Boolean) {
|
||||||
|
ret = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": " +
|
||||||
|
value;
|
||||||
} else if (value instanceof LinkedHashMap) {
|
} else if (value instanceof LinkedHashMap) {
|
||||||
String in = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": ";
|
String in = ret + JSON_ESCAPE_DOUBLE_QUOTE + key + JSON_ESCAPE_DOUBLE_QUOTE + ": ";
|
||||||
ret = traverseMap(((LinkedHashMap<String, Object>) value), in);
|
ret = traverseMap(((LinkedHashMap<String, Object>) value), in);
|
||||||
|
@ -602,11 +602,12 @@ public class PostmanCollectionCodegenTest {
|
|||||||
@Test
|
@Test
|
||||||
public void convertLinkedHashMapToJson() {
|
public void convertLinkedHashMapToJson() {
|
||||||
|
|
||||||
final String EXPECTED = "{\\n \\\"id\\\": 1,\\n \\\"city\\\": \\\"Amsterdam\\\"\\n}";
|
final String EXPECTED = "{\\n \\\"id\\\": 1,\\n \\\"city\\\": \\\"Amsterdam\\\",\\n \\\"safe\\\": true\\n}";
|
||||||
|
|
||||||
LinkedHashMap<String, Object> city = new LinkedHashMap<>();
|
LinkedHashMap<String, Object> city = new LinkedHashMap<>();
|
||||||
city.put("id", 1);
|
city.put("id", 1);
|
||||||
city.put("city", "Amsterdam");
|
city.put("city", "Amsterdam");
|
||||||
|
city.put("safe", true);
|
||||||
|
|
||||||
assertEquals(EXPECTED, new PostmanCollectionCodegen().convertToJson(city));
|
assertEquals(EXPECTED, new PostmanCollectionCodegen().convertToJson(city));
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user