diff --git a/src/main/resources/postman-v2/item.mustache b/src/main/resources/postman-v2/item.mustache index 806e626..56dbcc8 100644 --- a/src/main/resources/postman-v2/item.mustache +++ b/src/main/resources/postman-v2/item.mustache @@ -49,6 +49,7 @@ { "key": "{{paramName}}", "value": "{{example}}", + "description": "{{{description}}}", "disabled": {{#required}}false{{/required}}{{^required}}true{{/required}} }{{^-last}},{{/-last}} {{/queryParams}} diff --git a/src/test/java/com/tweesky/cloudtools/codegen/PostmanV2GeneratorTest.java b/src/test/java/com/tweesky/cloudtools/codegen/PostmanV2GeneratorTest.java index 4aef1d2..61a71ed 100644 --- a/src/test/java/com/tweesky/cloudtools/codegen/PostmanV2GeneratorTest.java +++ b/src/test/java/com/tweesky/cloudtools/codegen/PostmanV2GeneratorTest.java @@ -622,7 +622,7 @@ public void testMgmtApi() throws IOException, ParseException { } @Test - public void testRequiredQueryParameter() throws IOException, ParseException { + public void testRequiredQueryParameter() throws IOException { File output = Files.createTempDirectory("postmantest_").toFile(); output.deleteOnExit(); @@ -641,9 +641,32 @@ public void testRequiredQueryParameter() throws IOException, ParseException { Path path = Paths.get(output + "/postman.json"); TestUtils.assertFileExists(path); // verify param pUserId is set as disabled=false - TestUtils.assertFileContains(path, "{ \"key\": \"pUserId\", \"value\": \"888\", \"disabled\": false"); + TestUtils.assertFileContains(path, "{ \"key\": \"pUserId\", \"value\": \"888\", \"description\": \"Query Id.\", \"disabled\": false"); } + @Test + public void testQueryParameterDescription() throws IOException { + + File output = Files.createTempDirectory("postmantest_").toFile(); + output.deleteOnExit(); + + final CodegenConfigurator configurator = new CodegenConfigurator() + .setGeneratorName("postman-v2") + .setInputSpec("./src/test/resources/SampleProject.yaml") + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); + + DefaultGenerator generator = new DefaultGenerator(); + List files = generator.opts(configurator.toClientOptInput()).generate(); + + System.out.println(files); + files.forEach(File::deleteOnExit); + + Path path = Paths.get(output + "/postman.json"); + TestUtils.assertFileExists(path); + // verify param pUserId is set as disabled=false + TestUtils.assertFileContains(path, "{ \"key\": \"pUserId\", \"value\": \"888\", \"description\": \"Query Id.\""); + + } } \ No newline at end of file