Skip to content

feat(rust): name generated service types as prost-build does - #233

Merged
paralin merged 1 commit into
masterfrom
rust-plugin-prost-types
Oct 3, 2026
Merged

paralin merged 1 commit into
masterfrom
rust-plugin-prost-types

Conversation

@paralin

@paralin paralin commented Oct 3, 2026

Copy link
Copy Markdown
Member

protoc-gen-starpc-rust now resolves request and response types the way prost-build 0.14 does, so generated service files refer to the items protoc-gen-prost writes for the same schemas, including packages that Prost nests, renames or merges across directories. The plugin parses extern_path and compile_well_known_types, applies exact mappings before the longest package prefix, installs the default google.protobuf mappings and rejects duplicate paths and unknown options.

Service, method, stream trait and module names go through ports of Prost's identifier sanitizing and heck's case conversion. Their Apache-2.0 and MIT license texts sit beside the code. The generated constructors use the field shorthand that Clippy requires, which removes redundant_field_names errors from every generated service file.

Tests beside the code cover naming vectors, local, nested, cross-package and extern resolution, option parsing, two service files in one package and the constructor form. The plugin passes go vet and its Go tests. A project fixture and a 453-test consumer workspace generated, compiled, linted with warnings denied and passed their tests against the plugin built from this change.

protoc-gen-starpc-rust now resolves request and response types the way
prost-build 0.14 resolves them, so a service file refers to the items that
protoc-gen-prost wrote for the same schemas. Type paths follow the package
module tree, nested messages and renamed identifiers included. The plugin
parses extern_path and compile_well_known_types, applies exact mappings
before the longest package prefix, installs the default google.protobuf
mappings, rejects duplicate paths and rejects any other option.

Service, method, stream trait and module names use ports of Prost's
identifier sanitizing and heck's snake and upper camel case, kept with their
licenses beside the code. Constructors use the field shorthand that Clippy
requires.

Tests cover the naming vectors, local, nested, cross-package and extern
resolution, option parsing, two service files in one package and the
constructor form.

Signed-off-by: Christian Stewart <christian@aperture.us>
@paralin
paralin merged commit 4cdf886 into master Oct 3, 2026
23 checks passed
@paralin
paralin deleted the rust-plugin-prost-types branch October 3, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant