How to use the google-protobuf/google/protobuf/compiler/plugin_pb.CodeGeneratorResponse.File function in google-protobuf

To help you get started, we’ve selected a few google-protobuf examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github anjmao / rn-grpc-bridge / src / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {

            // react NativeModules grpc bridge types
            let tsTypes = TsNativeModuleTypes.gen(fileNameToDescriptor[fileName]);
            if (tsTypes !== '') {
                let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
                let svtTsdFile = new CodeGeneratorResponse.File();
                svtTsdFile.setName(`${svcFileName}_types.ts`);
                svtTsdFile.setContent(tsTypes);
                codeGenResponse.addFile(svtTsdFile);
            }

            // swift services
            let fileDescriptorOutput = SwiftGen.gen(fileNameToDescriptor[fileName]);
            if (fileDescriptorOutput !== '') {
                swiftFileContents.push(fileDescriptorOutput);
            }

            // swift objective-c headers
            let fileHeaderBridge = SwiftGenHeaderBridge.gen(fileNameToDescriptor[fileName]);
            if (fileHeaderBridge !== '') {
                rnBridgeContents.push(fileHeaderBridge);
            }
github agreatfool / grpc_tools_node_protoc_ts / src / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
            // message part
            let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
            let msgTsdFile = new CodeGeneratorResponse.File();
            msgTsdFile.setName(msgFileName + ".d.ts");
            const msgModel = ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            msgTsdFile.setContent(TplEngine.render('msg_tsd', msgModel));
            codeGenResponse.addFile(msgTsdFile);

            // service part
            let fileDescriptorModel = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            if (fileDescriptorModel != null) {
                let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
                let svtTsdFile = new CodeGeneratorResponse.File();
                svtTsdFile.setName(svcFileName + ".d.ts");
                svtTsdFile.setContent(TplEngine.render('svc_tsd', fileDescriptorModel));
                codeGenResponse.addFile(svtTsdFile);
            }
        });
github agreatfool / SASDN / src / proto_plugin / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
            // message part
            let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
            let msgTsdFile = new CodeGeneratorResponse.File();
            msgTsdFile.setName(msgFileName + ".d.ts");
            msgTsdFile.setContent(ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap));
            codeGenResponse.addFile(msgTsdFile);

            // service part
            let fileDescriptorOutput = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            if (fileDescriptorOutput != '') {
                let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
                let svtTsdFile = new CodeGeneratorResponse.File();
                svtTsdFile.setName(svcFileName + ".d.ts");
                svtTsdFile.setContent(fileDescriptorOutput);
                codeGenResponse.addFile(svtTsdFile);
            }
        });
github agreatfool / SASDN / src / proto_plugin / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
            // message part
            let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
            let msgTsdFile = new CodeGeneratorResponse.File();
            msgTsdFile.setName(msgFileName + ".d.ts");
            msgTsdFile.setContent(ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap));
            codeGenResponse.addFile(msgTsdFile);

            // service part
            let fileDescriptorOutput = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            if (fileDescriptorOutput != '') {
                let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
                let svtTsdFile = new CodeGeneratorResponse.File();
                svtTsdFile.setName(svcFileName + ".d.ts");
                svtTsdFile.setContent(fileDescriptorOutput);
                codeGenResponse.addFile(svtTsdFile);
            }
        });
github agreatfool / grpc_tools_node_protoc_ts / src / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
            // message part
            let msgFileName = Utility.filePathFromProtoWithoutExt(fileName);
            let msgTsdFile = new CodeGeneratorResponse.File();
            msgTsdFile.setName(msgFileName + ".d.ts");
            const msgModel = ProtoMsgTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            msgTsdFile.setContent(TplEngine.render('msg_tsd', msgModel));
            codeGenResponse.addFile(msgTsdFile);

            // service part
            let fileDescriptorModel = ProtoSvcTsdFormatter.format(fileNameToDescriptor[fileName], exportMap);
            if (fileDescriptorModel != null) {
                let svcFileName = Utility.svcFilePathFromProtoWithoutExt(fileName);
                let svtTsdFile = new CodeGeneratorResponse.File();
                svtTsdFile.setName(svcFileName + ".d.ts");
                svtTsdFile.setContent(TplEngine.render('svc_tsd', fileDescriptorModel));
                codeGenResponse.addFile(svtTsdFile);
            }
        });
github anjmao / rn-grpc-bridge / src / index.ts View on Github external
function addFile(rsp: CodeGeneratorResponse, fileName: string, fileContent: string) {
    const file = new CodeGeneratorResponse.File();
    file.setName(fileName);
    file.setContent(fileContent);
    rsp.addFile(file);
}
github stultuss / protoc-gen-grpc-ts / src / index.ts View on Github external
request.getFileToGenerateList().forEach(fileName => {
            const outputFileName = Utility.filePathFromProtoWithoutExtension(fileName);
            const outputFile = new CodeGeneratorResponse.File();
            outputFile.setName(outputFileName + '.d.ts');
            outputFile.setContent(FileDescriptorMSG.print(fileNameToDescriptor[fileName], entryMap));
            response.addFile(outputFile);

            if (generateServices) {
                const fileDescriptorOutput = FileDescriptorGRPC.print(fileNameToDescriptor[fileName], entryMap);
                if (fileDescriptorOutput !== '') {
                    const thisServiceFileName = Utility.svcFilePathFromProtoWithoutExtension(fileName);
                    const thisServiceFile = new CodeGeneratorResponse.File();
                    thisServiceFile.setName(thisServiceFileName + '.d.ts');
                    thisServiceFile.setContent(fileDescriptorOutput);
                    response.addFile(thisServiceFile);
                }
            }
        });
github improbable-eng / ts-protoc-gen / src / index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
      const outputFileName = replaceProtoSuffix(fileName);
      const thisFile = new CodeGeneratorResponse.File();
      thisFile.setName(outputFileName + ".d.ts");
      thisFile.setContent(printFileDescriptorTSD(fileNameToDescriptor[fileName], exportMap));
      codeGenResponse.addFile(thisFile);

      if (generateGrpcWebServices) {
        generateGrpcWebService(outputFileName, fileNameToDescriptor[fileName], exportMap)
          .forEach(file => codeGenResponse.addFile(file));
      } else if (generateGrpcNodeServices) {
        const file = generateGrpcNodeService(outputFileName, fileNameToDescriptor[fileName], exportMap);
        codeGenResponse.addFile(file);
      }
    });
github improbable-eng / ts-protoc-gen / src / js_service_index.ts View on Github external
codeGenRequest.getFileToGenerateList().forEach(fileName => {
      const fileDescriptorOutput = printFileDescriptorJSServices(fileNameToDescriptor[fileName], exportMap);
      if (fileDescriptorOutput != "") {
        const outputFileName = filePathFromProtoWithoutExtension(fileName);
        const thisFile = new CodeGeneratorResponse.File();
        thisFile.setName(outputFileName + "_service.js");
        thisFile.setContent(fileDescriptorOutput);
        codeGenResponse.addFile(thisFile)
      }
    });