forked from loafle/openapi-generator-original
[POSTMAN] Query parameter description (#17291)
* Include query parameter description * Generate samples
This commit is contained in:
@@ -49,6 +49,7 @@
|
||||
{
|
||||
"key": "{{paramName}}",
|
||||
"value": "{{example}}",
|
||||
"description": "{{{description}}}",
|
||||
"disabled": {{#required}}false{{/required}}{{^required}}true{{/required}}
|
||||
}{{^-last}},{{/-last}}
|
||||
{{/queryParams}}
|
||||
|
||||
+26
-1
@@ -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
|
||||
}
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user