Giter Site home page Giter Site logo

Comments (12)

dadadom avatar dadadom commented on May 22, 2024 2

I just put the complete code in a new repository:
https://github.com/dadadom/failing-reactor-grpc/

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024 1

Released in 0.7.3

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

Weird...I'll look into it. I wonder if this also affects the maven generator.

from reactive-grpc.

dadadom avatar dadadom commented on May 22, 2024

Sorry @rmichela , actually does fail with maven and the following pom.xml as well:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>mystuff</groupId>
    <artifactId>mytesting</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <properties>
        <maven.deploy.skip>true</maven.deploy.skip>
        <skipNexusStagingDeployMojo>true</skipNexusStagingDeployMojo>
	<maven.compiler.source>1.8</maven.compiler.source>
	<maven.compiler.target>1.8</maven.compiler.target>
    </properties>

    <dependencies>
        <dependency>
            <groupId>com.salesforce.servicelibs</groupId>
            <artifactId>reactor-grpc-stub</artifactId>
	    <version>0.7.1</version>
        </dependency>
	<dependency>
	    <groupId>io.grpc</groupId>
	    <artifactId>grpc-netty</artifactId>
	    <version>1.8.0</version>
	</dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-core</artifactId>
	    <version>1.8.0</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-stub</artifactId>
	    <version>1.8.0</version>
        </dependency>
        <dependency>
            <groupId>io.grpc</groupId>
            <artifactId>grpc-protobuf</artifactId>
	    <version>1.8.0</version>
        </dependency>
    </dependencies>

    <build>
        <extensions>
            <extension>
                <groupId>kr.motd.maven</groupId>
                <artifactId>os-maven-plugin</artifactId>
                <version>1.4.1.Final</version>
            </extension>
        </extensions>
        <plugins>
            <plugin>
                <groupId>org.xolstice.maven.plugins</groupId>
                <artifactId>protobuf-maven-plugin</artifactId>
                <version>0.5.1</version>
		<extensions>true</extensions>
                <configuration>
                    <protocArtifact>com.google.protobuf:protoc:3.5.0:exe:${os.detected.classifier}</protocArtifact>
                    <pluginId>grpc-java</pluginId>
                    <pluginArtifact>io.grpc:protoc-gen-grpc-java:1.8.0:exe:${os.detected.classifier}</pluginArtifact>
                </configuration>
                <executions>
                    <execution>
                        <goals>
                            <goal>compile</goal>
                            <goal>compile-custom</goal>
                        </goals>
                        <configuration>
                            <protocPlugins>
                                <protocPlugin>
                                    <id>reactor-grpc</id>
                                    <groupId>com.salesforce.servicelibs</groupId>
                                    <artifactId>reactor-grpc</artifactId>
                                    <version>0.7.1</version>
                                    <mainClass>com.salesforce.reactorgrpc.ReactorGrpcGenerator</mainClass>
                                </protocPlugin>
                            </protocPlugins>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

@cbornet Any ideas?

from reactive-grpc.

dadadom avatar dadadom commented on May 22, 2024

After some further investigation, it seems that this only fails iff the filename and the message name resolve to the same Java notation. In that case, the generated inputType and outputType for the mustache template, generated by the ProtoTypeMap from grpc-java-contrib seem to be wrongly generated.

I guess that the culprit is somewhere around https://github.com/salesforce/grpc-java-contrib/blob/master/jprotoc/src/main/java/com/salesforce/jprotoc/ProtoTypeMap.java#L54 , but I would have to investigate a bit further.

If needed, just close this issue and create a new one in https://github.com/salesforce/grpc-java-contrib

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

Root Cause

  • Absent option java_outer_classname, protoc generates an outer java class for each .proto file with a name derived from the .proto file name.
  • If no explicit java_outer_classname is specified in the .proto file, the class name will be constructed by converting the .proto file name to camel-case (so foo_bar.proto becomes FooBar.java)
  • Protoc generates an inner class for each message type in the proto with a name that matches the message type name.
  • In the event of a name conflict between the outer and inner type names, protoc adds an OuterClass suffix to the outer type's name.

JProtoc is not correctly accounting for the name collision between the outer and inner class name.

Workarounds

  1. Add option java_outer_classname = "SomeParameterProto"; to some_parameter.proto.
  2. Rename some_parameter.proto.

Mitigation

  1. Fix JProtoc salesforce/grpc-java-contrib#66
  2. Update Reactive-gRPC generator

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

salesforce/grpc-java-contrib#67

from reactive-grpc.

dadadom avatar dadadom commented on May 22, 2024

Any plans on releasing updated versions of jprotoc and reactive-grpc?

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

Yes. Today

from reactive-grpc.

rmichela avatar rmichela commented on May 22, 2024

salesforce/grpc-java-contrib#70

from reactive-grpc.

dadadom avatar dadadom commented on May 22, 2024

You guys rock, thanks!

from reactive-grpc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.