in docgen/src/main/java/org/apache/servicecomb/toolkit/docgen/ContractsSwaggerUIGenerator.java [70:95]
public void generate() {
if (!checkConfig()) {
throw new IllegalArgumentException("Cannot found configuration");
}
String swaggerUiHtml = null;
try {
String swaggerJson = Json.mapper().writeValueAsString(contractContent);
swaggerUiHtml = renderHtml(getSwaggerUiHtml(), Collections.singletonMap("spec", swaggerJson));
outputPath = correctPath(outputPath);
Path outputFile = Paths.get(outputPath);
if (!Files.exists(outputFile)) {
if (outputFile.getParent() != null) {
Files.createDirectories(outputFile.getParent());
}
Files.createFile(outputFile);
}
Files.write(outputFile, swaggerUiHtml.getBytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}