class MergingConfigProvider implements ConfigurationSourceProvider {

  @Override
  public InputStream open(String path) throws IOException {
    JsonNode originalNode = readFromPath(defaultConfigPath);
    JsonNode overrideNode = readFromPath(path);

    if (originalNode.isObject() && overrideNode.isObject()) {
      ObjectNode original = (ObjectNode) originalNode;
      ObjectNode override = (ObjectNode) overrideNode;

      merge(original, override);
      ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
      objectMapper.writeTree(yamlFactory.createGenerator(outputStream), original);

      return new ByteArrayInputStream(outputStream.toByteArray());
    } else {
      throw new IllegalArgumentException("Both configuration files must be objects");
    }
  }

  public  MergingConfigProvider(ConfigurationSourceProvider delegate, String defaultConfigPath, ObjectMapper objectMapper, YAMLFactory yamlFactory);

}