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

Support reading protobuf definitions contained within a Substreams package #1737

Open
alex-pakalniskis opened this issue Oct 3, 2024 Discussed in #1639 · 1 comment
Open

Comments

@alex-pakalniskis
Copy link
Collaborator

Discussed in #1639

Originally posted by alex-pakalniskis April 22, 2024

Problem

Even though Substreams packages contain relevant protobuf definitions, Substreams-powered subgraph developers are unable to reference those protobuf definitions when generating AssemblyScript types for their subgraph with protoc. See this example protoc command supporting wildcard matching of protobuf files.

protoc --plugin=./node_modules/protobuf-as/bin/protoc-gen-as --as_out=src/pb/ ./proto/*.proto

protoc does not natively parse Substreams packages, so users are left unable to proceed unless they source the required files. Furthermore, protobuf files are not easily found on the Substreams registry, so users must search GitHub and hope for the best. Locating the exactly correct protobuf definition files for a Substreams package adds unnecessary friction to the Substreams-powered subgraph developer experience.

Potential solution

Enable Graph CLI to generate AssemblyScript types from the *.proto files contained in a Substreams package (perhaps its just a nice wrapper for protoc + protobuf-as)

graph protogen #create a new command specific to protobuf files to look for `*.proto` files in `*.spkg`
# or
graph codegen #extend codegen to look for `*.proto` files in `*.spkg` if Substreams-powered subgraph
@alex-pakalniskis
Copy link
Collaborator Author

related to #1659

@alex-pakalniskis alex-pakalniskis added this to the SPS experience milestone Oct 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 Next
Development

No branches or pull requests

1 participant