Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regenerate gRPC classes after removing grpc-gateway / grpc -> OpenAPI spec metadata #78

Merged
merged 1 commit into from
Mar 12, 2024

Conversation

austin-denoble
Copy link
Contributor

@austin-denoble austin-denoble commented Mar 8, 2024

Problem

Currently, the Java classes we generate from vector_service.proto include several lines of code which cause builds to fail, and are currently commented out.

Example of build errors after generation:
Screenshot 2024-03-08 at 4 16 45 PM

The gist is it seems like the grpc-gateway package is unable to be resolved during generation.

Solution

We generate the Java gRPC classes using protoc and a plugin: protoc-gen-grpc-java. You can see the general approach here: https://github.com/pinecone-io/pinecone-protos/blob/main/scripts/sdk-grpc-generation/java/gen.sh

I talked with @haruska as I was having trouble getting the grpc-gateway to resolve, even though it seems to be provided in /thirdparty/. I tried pulling in the thirdparty protos manually and updating the paths, but it seems like the Java plugin we use may not support grpc-gateway, although I haven't been able to confirm this.

After talking with @haruska, he mentioned he had pulled out all of the grpc -> openapi spec information from the proto file before generation in the Go client: https://github.com/pinecone-io/go-pinecone/blob/main/apis/proto/pinecone/data/v1/vector_service.proto.

I went with re-generating the Java classes using this same approach. The grpc-gateway bits should not be needed for the client code as we don't care about the REST -> gRPC conversion.

Jason mentioned we may want to look at generating this version of the spec pre-codegen for Java and Go.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)

Test Plan

Build + Integration Tests via CI

@austin-denoble austin-denoble marked this pull request as ready for review March 8, 2024 23:02
Copy link
Contributor

@rohanshah18 rohanshah18 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for handling this code generation issue. Tested it against serverless indexes as well, so we are good to go.

@austin-denoble austin-denoble merged commit 5c6024e into main Mar 12, 2024
8 checks passed
@austin-denoble austin-denoble deleted the adenoble/fix-grpc-generated-imports branch March 12, 2024 00:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants