[POSTMAN] Query parameter description (#17291)

* Include query parameter description

* Generate samples
This commit is contained in:
Beppe Catanese
2023-12-03 01:05:44 +01:00
committed by GitHub
parent 64e5266556
commit 6657b2c5c2
3 changed files with 28 additions and 1 deletions
@@ -49,6 +49,7 @@
{
"key": "{{paramName}}",
"value": "{{example}}",
"description": "{{{description}}}",
"disabled": {{#required}}false{{/required}}{{^required}}true{{/required}}
}{{^-last}},{{/-last}}
{{/queryParams}}
@@ -775,8 +775,33 @@ public class PostmanCollectionCodegenTest {
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<File> 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.\"");
}
}
@@ -286,6 +286,7 @@
{
"key": "pUserId",
"value": "888",
"description": "Query Id.",
"disabled": false
}
]