class RestAPIDocGenerator {

	@VisibleForTesting
	static void createHtmlFile(DocumentingRestEndpoint restEndpoint, RestAPIVersion apiVersion, Path outputFile) throws IOException {
		StringBuilder html = new StringBuilder();

		List<MessageHeaders> specs = restEndpoint.getSpecs().stream()
			.filter(spec -> spec.getSupportedAPIVersions().contains(apiVersion))
			.filter(RestAPIDocGenerator::shouldBeDocumented)
			.collect(Collectors.toList());
		specs.forEach(spec -> html.append(createHtmlEntry(spec)));

		Files.deleteIfExists(outputFile);
		Files.write(outputFile, html.toString().getBytes(StandardCharsets.UTF_8));
	}

}