use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class RubyGapicSurfaceDocTransformer method generateDoc.
private ViewModel generateDoc(ProtoFile file, GapicProductConfig productConfig) {
ModelTypeTable typeTable = new ModelTypeTable(new RubyTypeTable(productConfig.getPackageName()), new RubyModelTypeNameConverter(productConfig.getPackageName()));
// Use file path for package name to get file-specific package instead of package for the API.
SurfaceNamer namer = new RubySurfaceNamer(typeTable.getFullNameFor(file));
String subPath = pathMapper.getOutputPath(file.getFullName(), productConfig);
String baseFilename = namer.getProtoFileName(file.getSimpleName());
GrpcDocView.Builder doc = GrpcDocView.newBuilder();
doc.templateFileName(DOC_TEMPLATE_FILENAME);
doc.outputPath(subPath + "/doc/" + baseFilename);
doc.fileHeader(fileHeaderTransformer.generateFileHeader(productConfig, ImportSectionView.newBuilder().build(), namer));
doc.elementDocs(elementDocTransformer.generateElementDocs(productConfig, typeTable, namer, file));
doc.modules(generateModuleViews(new ProtoApiModel(file.getModel()), productConfig, namer, isSourceApiInterfaceFile(file) ? file : null));
return doc.build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class PythonPackageMetadataTransformer method generateTopLevelFiles.
private List<ViewModel> generateTopLevelFiles(ApiModel model, GapicProductConfig productConfig) {
PackageMetadataNamer namer = new PackageMetadataNamer();
SurfaceNamer surfaceNamer = new PythonSurfaceNamer(productConfig.getPackageName());
ImmutableList.Builder<ViewModel> metadata = ImmutableList.builder();
for (Map.Entry<String, String> entry : TOP_LEVEL_TEMPLATE_FILES.entrySet()) {
metadata.add(generateMetadataView(model, productConfig, entry.getKey(), namer, surfaceNamer, entry.getValue()).build());
}
return metadata.build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class GoGapicSurfaceTestTransformer method createSmokeTestClassView.
private SmokeTestClassView createSmokeTestClassView(InterfaceContext context) {
SurfaceNamer namer = context.getNamer();
MethodModel method = context.getInterfaceConfig().getSmokeTestConfig().getMethod();
MethodContext methodContext = context.asRequestMethodContext(method);
SmokeTestClassView.Builder testClass = SmokeTestClassView.newBuilder();
StaticLangApiMethodView apiMethodView = createSmokeTestCaseApiMethodView(methodContext);
testClass.apiSettingsClassName(namer.getApiSettingsClassName(context.getInterfaceConfig()));
testClass.apiClassName(namer.getApiWrapperClassName(context.getInterfaceConfig()));
testClass.name(namer.getSmokeTestClassName(context.getInterfaceConfig()));
testClass.outputPath(context.getProductConfig().getPackageName() + File.separator + method.getSimpleName() + "_smoke_test.go");
testClass.templateFileName(SMOKE_TEST_TEMPLATE_FILE);
testClass.apiMethod(apiMethodView);
testClass.requireProjectId(testCaseTransformer.requireProjectIdInSmokeTest(apiMethodView.initCode(), context.getNamer()));
// The shared code above add imports both for input and output.
// Since we use short decls, we don't need to import anything for output.
context.getImportTypeTable().getImports().clear();
method.getAndSaveRequestTypeName(methodContext.getTypeTable(), methodContext.getNamer());
FileHeaderView fileHeader = fileHeaderTransformer.generateFileHeader(context);
testClass.fileHeader(fileHeader);
return testClass.build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class NodeJSGapicSurfaceTransformer method generateProtoList.
private ViewModel generateProtoList(GapicInterfaceContext context) {
DynamicLangXApiView.Builder protoList = prepareApiClassBuilder(context);
SurfaceNamer namer = context.getNamer();
String subPath = pathMapper.getOutputPath(context.getInterface().getFullName(), context.getProductConfig());
protoList.templateFileName(PROTO_LIST_TEMPLATE_FILENAME);
protoList.outputPath(subPath + "/" + namer.getProtoListFileName(context.getInterfaceConfig()));
return protoList.build();
}
use of com.google.api.codegen.transformer.SurfaceNamer in project toolkit by googleapis.
the class NodeJSGapicSurfaceTransformer method generateApiClass.
private ViewModel generateApiClass(GapicInterfaceContext context) {
DynamicLangXApiView.Builder xapiClass = prepareApiClassBuilder(context);
SurfaceNamer namer = context.getNamer();
String subPath = pathMapper.getOutputPath(context.getInterface().getFullName(), context.getProductConfig());
xapiClass.templateFileName(XAPI_TEMPLATE_FILENAME);
xapiClass.outputPath(subPath + "/" + namer.getServiceFileName(context.getInterfaceConfig()));
return xapiClass.build();
}
Aggregations