unable to call grpc method with namespace #656

Closed
opened 2025-12-29 15:29:50 +01:00 by adam · 6 comments
Owner

Originally created by @GomesNayagam on GitHub (Dec 30, 2024).

Originally assigned to: @StefH on GitHub.

//option csharp_namespace = "NarrowTest";

package Policy;

service PolicyService { }
            server
                //.AddProtoDefinition(id, protoDefinitionText)
                .Given(
                    Request
                        .Create()
                        .UsingPost()
                        .WithHttpVersion("2")
                        .WithPath("/NarrowTest.Policy.PolicyService/GetVersion")
                )
                .WithProtoDefinition(id)
                .RespondWith(
                    Response
                        .Create()
                        .WithHeader("Content-Type", "application/grpc")
                        .WithTrailingHeader("grpc-status", "0")
                        .WithBodyAsProtoBuf(
                            protoDefinition,
                            "Policy.GetVersionResponse",
                            new { Version = "DevTr1" }
                        )
                        .WithTransformer()
                );
Originally created by @GomesNayagam on GitHub (Dec 30, 2024). Originally assigned to: @StefH on GitHub. ``` proto //option csharp_namespace = "NarrowTest"; package Policy; service PolicyService { } ``` ``` c# server //.AddProtoDefinition(id, protoDefinitionText) .Given( Request .Create() .UsingPost() .WithHttpVersion("2") .WithPath("/NarrowTest.Policy.PolicyService/GetVersion") ) .WithProtoDefinition(id) .RespondWith( Response .Create() .WithHeader("Content-Type", "application/grpc") .WithTrailingHeader("grpc-status", "0") .WithBodyAsProtoBuf( protoDefinition, "Policy.GetVersionResponse", new { Version = "DevTr1" } ) .WithTransformer() ); ```
adam added the bug label 2025-12-29 15:29:50 +01:00
adam closed this issue 2025-12-29 15:29:50 +01:00
Author
Owner

@StefH commented on GitHub (Dec 31, 2024):

Did you try "Policy.PolicyService/GetVersion"?

Because I think that //option csharp_namespace = "NarrowTest"; is not yet supported.

@StefH commented on GitHub (Dec 31, 2024): Did you try "Policy.PolicyService/GetVersion"? Because I think that `//option csharp_namespace = "NarrowTest";` is not yet supported.
Author
Owner

@GomesNayagam commented on GitHub (Dec 31, 2024):

yes Policy.PolicyService/GetVersion works, so i commented teh option chartp_namespace now to move fwd.

@GomesNayagam commented on GitHub (Dec 31, 2024): yes Policy.PolicyService/GetVersion works, so i commented teh option chartp_namespace now to move fwd.
Author
Owner

@StefH commented on GitHub (Jan 1, 2025):

This is indeed a bug.

Will be fixed here
https://github.com/StefH/ProtoBufJsonConverter/pull/23

@StefH commented on GitHub (Jan 1, 2025): This is indeed a bug. Will be fixed here https://github.com/StefH/ProtoBufJsonConverter/pull/23
Author
Owner

@StefH commented on GitHub (Jan 4, 2025):

Also this is fixed by preview version 1.6.11-ci-19550, can you also test this one?

@StefH commented on GitHub (Jan 4, 2025): Also this is fixed by preview version 1.6.11-ci-19550, can you also test this one?
Author
Owner

@StefH commented on GitHub (Jan 7, 2025):

@GomesNayagam
Can you please retry if preview 1.6.11-ci-19552 does also solve this namespace issue?

@StefH commented on GitHub (Jan 7, 2025): @GomesNayagam Can you please retry if preview 1.6.11-ci-19552 does also solve this namespace issue?
Author
Owner

@GomesNayagam commented on GitHub (May 9, 2025):

@StefH tested with 1.6.11 and it dint work, below is the code

syntax = "proto3";

import "google/protobuf/timestamp.proto";

option csharp_namespace = "NarrowTest";

service PolicyService2 {	
    rpc GetVersion (GetVersionRequest) returns (GetVersionResponse);
	rpc GetVersion2 (GetVersion2Request) returns (GetVersion2Response);
    rpc GetHolidayCalendar (GetHolidayCalendarRequest) returns (GetHolidayCalendarResponse);
	rpc GetCancellationDetail (GetCancellationDetailRequest) returns (GetCancellationDetailResponse);
}

            server
                //.AddProtoDefinition(id, protoDefinitionText)
                .Given(
                    Request
                        .Create()
                        .UsingPost()
                        .WithHttpVersion("2")
                        .WithPath("/NarrowTest.PolicyService2/GetCancellationDetail")
                        .WithBodyAsProtoBuf(
                            protoDefinition,
                            "NarrowTest.GetCancellationDetailRequest",
                            protoBufJsonMatcher5
                        )
                )
                .WithProtoDefinition(id)
                .RespondWith(
                    Response
                        .Create()
                        .WithHeader("Content-Type", "application/grpc")
                        .WithTrailingHeader("grpc-status", "0")
                        .WithBodyAsProtoBuf(
                            protoDefinition,
                            "NarrowTest.GetCancellationDetailResponse",
                            res3!
                        )
                        .WithTransformer()
                );
@GomesNayagam commented on GitHub (May 9, 2025): @StefH tested with 1.6.11 and it dint work, below is the code ```proto syntax = "proto3"; import "google/protobuf/timestamp.proto"; option csharp_namespace = "NarrowTest"; service PolicyService2 { rpc GetVersion (GetVersionRequest) returns (GetVersionResponse); rpc GetVersion2 (GetVersion2Request) returns (GetVersion2Response); rpc GetHolidayCalendar (GetHolidayCalendarRequest) returns (GetHolidayCalendarResponse); rpc GetCancellationDetail (GetCancellationDetailRequest) returns (GetCancellationDetailResponse); } ``` ```c# server //.AddProtoDefinition(id, protoDefinitionText) .Given( Request .Create() .UsingPost() .WithHttpVersion("2") .WithPath("/NarrowTest.PolicyService2/GetCancellationDetail") .WithBodyAsProtoBuf( protoDefinition, "NarrowTest.GetCancellationDetailRequest", protoBufJsonMatcher5 ) ) .WithProtoDefinition(id) .RespondWith( Response .Create() .WithHeader("Content-Type", "application/grpc") .WithTrailingHeader("grpc-status", "0") .WithBodyAsProtoBuf( protoDefinition, "NarrowTest.GetCancellationDetailResponse", res3! ) .WithTransformer() ); ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#656