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

feat(generator/rust): full rename of module path #757

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions generator/internal/language/rust.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ func newRustCodec(options map[string]string) (*rustCodec, error) {
year, _, _ := time.Now().Date()
codec := &rustCodec{
generationYear: fmt.Sprintf("%04d", year),
modulePath: "model",
modulePath: "crate::model",
deserializeWithdDefaults: true,
extraPackages: []*rustPackage{},
packageMapping: map[string]*rustPackage{},
Expand Down Expand Up @@ -606,7 +606,7 @@ func rustMessageName(m *api.Message) string {
func rustMessageScopeName(m *api.Message, childPackageName, modulePath, sourceSpecificationPackageName string, packageMapping map[string]*rustPackage) string {
rustPkg := func(packageName string) string {
if packageName == sourceSpecificationPackageName {
return "crate::" + modulePath
return modulePath
}
mapped, ok := rustMapPackage(packageName, packageMapping)
if !ok {
Expand Down
4 changes: 2 additions & 2 deletions generator/internal/language/rust_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ func createRustCodec() *rustCodec {
}

return &rustCodec{
modulePath: "model",
modulePath: "crate::model",
extraPackages: []*rustPackage{wkt},
packageMapping: map[string]*rustPackage{
"google.protobuf": wkt,
Expand Down Expand Up @@ -1377,7 +1377,7 @@ func TestRust_FormatDocCommentsCrossLinks(t *testing.T) {
path: "src/generated/iam/v1",
}
c := &rustCodec{
modulePath: "model",
modulePath: "crate::model",
extraPackages: []*rustPackage{wkt, iam},
packageMapping: map[string]*rustPackage{
"google.protobuf": wkt,
Expand Down
2 changes: 1 addition & 1 deletion generator/internal/sidekick/sidekick_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ func TestRustModuleFromProtobuf(t *testing.T) {
ServiceConfig: "google/rpc/rpc_publish.yaml",
Name: "rpc",
ExtraOptions: map[string]string{
"module-path": "error::rpc::generated",
"module-path": "crate::error::rpc::generated",
"deserialize-with-defaults": "false",
"package:wkt": "package=gcp-sdk-wkt,path=src/wkt,source=google.protobuf",
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ googleapis-root = 'testdata/googleapis'
copyright-year = '2024'
deserialize-with-defaults = 'false'
generate-module = 'true'
module-path = 'error::rpc::generated'
module-path = 'crate::error::rpc::generated'
'package:wkt' = 'package=gcp-sdk-wkt,path=src/wkt,source=google.protobuf'
Loading