Generator
EasyP includes a powerful generator that simplifies the process of generating code from proto files. By using YAML configurations, EasyP makes this process more user-friendly and intuitive compared to using the protoc command directly.
Key Features of the Generator
-
Simplified Code Generation:
- Generate code from proto files using a
YAMLconfiguration. - Avoid the need to write long and complex protoc commands.
- Generate code from proto files using a
-
Wrapper around protoc:
- EasyP functions as a wrapper around protoc, providing a more convenient API through configuration files.
- Supports all options and plugins available in protoc.
-
Flexibility and Customization:
- Use the same parameters as protoc plugins, directly in the configuration file.
- Support for multiple plugins and their parameters in a single configuration.
-
Generate Code from Multiple Sources:
- Generate code from local directories or remote repositories.
- Easily integrate with existing projects and repositories.
-
Remote Generation:
- Generate code from remote Git repositories without local checkout.
-
Package Manager Integration:
- Seamless integration with EasyP's package manager for dependency management.
- Automatic resolution and inclusion of proto dependencies.
Configuration Reference
Generator Configuration Comparison
# Package manager dependencies
deps:
- github.com/googleapis/googleapis@common-protos-1_3_1
- github.com/grpc-ecosystem/grpc-gateway@v2.19.1
- github.com/bufbuild/protoc-gen-validate@v0.10.1
# Code generation configuration
generate:
plugins:
- name: go
out: ./gen/go
opts:
paths: source_relative
module: github.com/mycompany/myproject
with_imports: true
- name: go-grpc
out: ./gen/go
opts:
paths: source_relative
require_unimplemented_servers: falseMulti-Language Plugin Examples
plugins:
- name: go
out: ./gen/go
opts:
paths: source_relative
- name: go-grpc
out: ./gen/go
opts:
paths: source_relative
require_unimplemented_servers: falseExecution Commands
easyp generate