use of com.google.api.codegen.util.js.JSTypeTable in project toolkit by googleapis.
the class NodeJSGapicSurfaceDocTransformer method generateDoc.
private ViewModel generateDoc(ProtoFile file, GapicProductConfig productConfig) {
ModelTypeTable typeTable = new ModelTypeTable(new JSTypeTable(productConfig.getPackageName()), new NodeJSModelTypeNameConverter(productConfig.getPackageName()));
// Use file path for package name to get file-specific package instead of package for the API.
SurfaceNamer namer = new NodeJSSurfaceNamer(productConfig.getPackageName(), NodeJSUtils.isGcloud(productConfig));
JSCommentReformatter commentReformatter = new JSCommentReformatter();
GrpcDocView.Builder doc = GrpcDocView.newBuilder();
doc.templateFileName(DOC_TEMPLATE_FILENAME);
doc.outputPath(getOutputPath(namer, file));
doc.fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, ImportSectionView.newBuilder().build(), namer));
doc.elementDocs(grpcElementDocTransformer.generateElementDocs(typeTable, namer, file));
return doc.build();
}
use of com.google.api.codegen.util.js.JSTypeTable in project toolkit by googleapis.
the class NodeJSModelTypeNameConverterTest method testGetEnumValue.
@Test
public void testGetEnumValue() {
String packageName = "library.v1";
TypeRef type = ModelTypeNameConverterTestUtil.getTestEnumType(tempDir);
EnumValue value = type.getEnumType().getValues().get(0);
NodeJSModelTypeNameConverter converter = new NodeJSModelTypeNameConverter(packageName);
Truth.assertThat(converter.getEnumValue(type, value).getValueAndSaveTypeNicknameIn(new JSTypeTable(packageName))).isEqualTo("'GOOD'");
}
Aggregations