|
6 | 6 | import com.fasterxml.jackson.databind.node.ObjectNode; |
7 | 7 | import org.junit.Assert; |
8 | 8 | import org.junit.Test; |
9 | | -import org.openapitools.codegen.ClientOptInput; |
10 | | -import org.openapitools.codegen.CodegenParameter; |
11 | | -import org.openapitools.codegen.CodegenProperty; |
12 | | -import org.openapitools.codegen.DefaultGenerator; |
| 9 | +import org.openapitools.codegen.*; |
13 | 10 | import org.openapitools.codegen.config.CodegenConfigurator; |
14 | 11 | import org.openapitools.codegen.languages.PostmanCollectionCodegen; |
15 | 12 |
|
@@ -466,6 +463,32 @@ public void testSkipGeneratedVariables() throws IOException, Exception { |
466 | 463 |
|
467 | 464 | } |
468 | 465 |
|
| 466 | + @Test |
| 467 | + public void testHeaderParameters() throws IOException { |
| 468 | + |
| 469 | + File output = Files.createTempDirectory("postmantest_").toFile(); |
| 470 | + output.deleteOnExit(); |
| 471 | + |
| 472 | + final CodegenConfigurator configurator = new CodegenConfigurator() |
| 473 | + .setGeneratorName("postman-collection") |
| 474 | + .setInputSpec("./src/test/resources/SampleProject.yaml") |
| 475 | + .setInputSpec("src/test/resources/3_0/postman-collection/SampleProject.yaml") |
| 476 | + .setOutputDir(output.getAbsolutePath().replace("\\", "/")); |
| 477 | + |
| 478 | + final ClientOptInput clientOptInput = configurator.toClientOptInput(); |
| 479 | + DefaultGenerator generator = new DefaultGenerator(); |
| 480 | + List<File> files = generator.opts(clientOptInput).generate(); |
| 481 | + |
| 482 | + files.forEach(File::deleteOnExit); |
| 483 | + |
| 484 | + Path path = Paths.get(output + "/postman.json"); |
| 485 | + TestUtils.assertFileExists(path); |
| 486 | + TestUtils.assertFileContains(path, "{ \"key\": \"Content-Type\", \"value\": \"application/json\""); |
| 487 | + TestUtils.assertFileContains(path, "{ \"key\": \"Accept\", \"value\": \"application/json\""); |
| 488 | + TestUtils.assertFileContains(path, "{ \"key\": \"Custom-Header\", \"value\": \"null\""); |
| 489 | + } |
| 490 | + |
| 491 | + |
469 | 492 | @Test |
470 | 493 | public void testFormatDescription() { |
471 | 494 |
|
|
0 commit comments