private static void processFile(File next, Path inputDirectory, Path outputDirectory) {
    try {
      String fileContents = IOUtils.toString(new FileInputStream(next));
      fileContents = fileContents.replaceAll("\\.json", ".yaml");

      final JsonNode jsonNode =
          DeserializationUtils.deserializeIntoTree(fileContents, next.toString());

      final String yamlOutput =
          Yaml.mapper().writerWithDefaultPrettyPrinter().writeValueAsString(jsonNode);

      final String relativePath =
          "./" + next.toString().replace(inputDirectory.toString(), "").replace(".json", ".yaml");

      final Path outputFile = outputDirectory.resolve(relativePath).normalize();
      LOGGER.debug("output file: " + outputFile);

      final File file = outputFile.toAbsolutePath().toFile();
      FileUtils.forceMkdir(outputFile.getParent().toFile());
      FileUtils.write(file, yamlOutput);

    } catch (IOException e) {
      throw new RuntimeException("Could not process file " + next, e);
    }
  }
 private void assertDescriptorYaml(Operation o, Throwable e) {
   assertNull(e);
   try {
     Swagger swagger = Yaml.mapper().readValue(o.getBody(String.class), Swagger.class);
     assertSwagger(swagger);
   } catch (IOException ioe) {
     fail(ioe.getMessage());
   }
 }
  @Override
  public void run(InflectorServerConfiguration configuration, Environment environment)
      throws Exception {
    final FilterRegistration.Dynamic cors =
        environment.servlets().addFilter("crossOriginRequsts", CrossOriginFilter.class);
    cors.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), true, "/*");

    SwaggerInflector inflector =
        new SwaggerInflector(Configuration.read(configuration.getConfig()));
    environment.jersey().getResourceConfig().registerResources(inflector.getResources());

    // add serializers for swagger
    environment.jersey().register(SwaggerSerializers.class);

    // example serializers
    environment.jersey().register(ExampleSerializer.class);

    // mappers
    SimpleModule simpleModule = new SimpleModule();
    simpleModule.addSerializer(new JsonNodeExampleSerializer());
    Json.mapper().registerModule(simpleModule);
    Yaml.mapper().registerModule(simpleModule);
  }
 public static boolean compareAsYaml(Object objectToSerialize, String yamlStr) {
   return apply(objectToSerialize, yamlStr, Yaml.mapper());
 }