use of com.palantir.conjure.postman.writer.DefaultPostmanCollectionFileWriter in project conjure-postman by palantir.
the class ConjurePostmanCli method generate.
static void generate(File target, File outputDirectory, GeneratorConfiguration config) {
try {
ConjureDefinition conjureDefinition = OBJECT_MAPPER.readValue(target, ConjureDefinition.class);
PostmanCollectionFileWriter writer = new DefaultPostmanCollectionFileWriter(outputDirectory.toPath());
PostmanCollectionGenerator generator = new PostmanCollectionGenerator(config);
writer.write(generator.generate(conjureDefinition));
} catch (IOException e) {
throw new RuntimeException(String.format("Error parsing definition: %s", e.toString()));
}
}
use of com.palantir.conjure.postman.writer.DefaultPostmanCollectionFileWriter in project conjure-postman by palantir.
the class ConjurePostmanGeneratorTest method maybeResetExpectedDirectory.
private void maybeResetExpectedDirectory(Path expected, ConjureDefinition definition) throws IOException {
if (Boolean.valueOf(System.getProperty("recreate", "false")) || !expected.toFile().isDirectory()) {
Files.createDirectories(expected);
try (Stream<Path> walk = Files.walk(expected)) {
walk.filter(path -> path.toFile().isFile()).forEach(path -> path.toFile().delete());
}
try (Stream<Path> walk = Files.walk(expected)) {
walk.forEach(path -> path.toFile().delete());
}
Files.createDirectories(expected);
PostmanCollectionFileWriter defaultWriter = new DefaultPostmanCollectionFileWriter(expected);
defaultWriter.write(generator.generate(definition));
}
}
Aggregations