use of com.google.api.codegen.discovery.Document in project toolkit by googleapis.
the class DiscoConfigGeneratorApi method setupDocument.
/**
* Initializes the Discovery document document.
*/
private Document setupDocument() {
// Prevent INFO messages from polluting the log.
Logger.getLogger("").setLevel(Level.WARNING);
String discoveryDocPath = options.get(DiscoGapicGeneratorApi.DISCOVERY_DOC);
Document document = null;
try {
document = DocumentGenerator.createDocumentAndLog(discoveryDocPath, getDiagCollector());
} catch (FileNotFoundException e) {
getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "File not found: " + discoveryDocPath));
} catch (IOException e) {
getDiagCollector().addDiag(Diag.error(SimpleLocation.TOPLEVEL, "Failed to read Discovery Doc: " + discoveryDocPath));
}
return document;
}
use of com.google.api.codegen.discovery.Document in project toolkit by googleapis.
the class DiscoConfigGeneratorApi method generateConfig.
private Map<String, Doc> generateConfig(String outputPath) {
Document document = setupDocument();
ViewModel viewModel = new DiscoConfigTransformer().generateConfig(new DiscoApiModel(document, ""), outputPath);
Doc generatedConfig = new CommonSnippetSetRunner(new CommonRenderingUtil()).generate(viewModel);
return ImmutableMap.of(outputPath, generatedConfig);
}
Aggregations