Grpc: breaking changes from 1.6.11 to 1.6.12 #686

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

Originally created by @GomesNayagam on GitHub (Apr 21, 2025).

Originally assigned to: @StefH on GitHub.

Describe the bug @StefH

Unimplemented error because, the response string is not matching.

Expected behavior:

Should deserialize response string and no error, All works if i revert the package to 1.6.8.

Test to reproduce

            var protoBufJsonMatcher5 = new JsonPartialWildcardMatcher(
                "{\"Client\":{\"CorrelationId\":\"*\"}}",
                false,
                true
            );

            var res3 = JsonConvert.DeserializeObject(
                "{\"Status\":{\"HasErrors\":false,\"HasWarnings\":false,\"Errors\":[],\"Warnings\":[],\"CorrelationId\":\"b8ad0d04-ed2f-42e1-ac85-339d91dc9855\"},\"CancellationCode\":\"\",\"CancellationName\":\"\",\"CancellationDescription\":\"\",\"CancellationEffDate\":null,\"NonRenewalCode\":\"\",\"NonRenewalName\":\"\",\"NonRenewalDescription\":\"\",\"NonRenewalEffDate\":null,\"LastReinstatementDate\":null}"
                );

            server
                //.AddProtoDefinition(id, protoDefinitionText)
                .Given(
                    Request
                        .Create()
                        .UsingPost()
                        .WithHttpVersion("2")
                        .WithPath("/Policy2.PolicyService2/GetCancellationDetail")
                        .WithBodyAsProtoBuf(
                            protoDefinition,
                            "Policy2.GetCancellationDetailRequest",
                            protoBufJsonMatcher5
                        )
                )
                .WithProtoDefinition(id)
                .RespondWith(
                    Response
                        .Create()
                        .WithHeader("Content-Type", "application/grpc")
                        .WithTrailingHeader("grpc-status", "0")
                        .WithBodyAsProtoBuf(
                            protoDefinition,
                            "Policy2.GetCancellationDetailResponse",
                            res3!
                        )
                        .WithTransformer()
                );


            var reply4 = await client.GetCancellationDetailAsync(
                new Policy2.GetCancellationDetailRequest { Client = cl }
            );

.proto file:


syntax = "proto3";

import "google/protobuf/timestamp.proto";

// option csharp_namespace = "NarrowIntegrationTest.Lookup";

package Policy2;

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

// REQUEST/RESPONSE DEFINITIONS

message GetCancellationDetailRequest {
	Client Client = 1;
	LegacyPolicyKey LegacyPolicyKey = 2;
}

message GetCancellationDetailResponse {
	ResponseStatus Status = 1;
	string CancellationCode = 2;
	string CancellationName = 3;
	string CancellationDescription = 4;
	google.protobuf.Timestamp CancellationEffDate = 5;
	string NonRenewalCode = 6;
	string NonRenewalName = 7;
	string NonRenewalDescription = 8;
	google.protobuf.Timestamp NonRenewalEffDate = 9;
	google.protobuf.Timestamp LastReinstatementDate = 10; // Always send the last reinstatement date if present on the policy term.
}

message LegacyPolicyKey {
	string Group = 1;
	int32 UnitNumber = 2;
	int32 Year = 3;
	string Suffix = 4;
}


message ResponseStatus {
	bool HasErrors = 1;
	bool HasWarnings =2;
	repeated string Errors = 3;
	repeated string Warnings = 4;
	string CorrelationId = 5;

}

message Client {
	string CorrelationId = 1;
	enum Clients {
		Unknown = 0;
        QMS = 1;
        BillingCenter = 2;
        PAS = 3;
        Payroll = 4;
        Portal = 5;
        SFO = 6;
        QuoteAndBind = 7;
        LegacyConversion = 8;
        BindNow = 9;
		PaymentPortal = 10 ;
		PricingEngine = 11;
	}
	Clients ClientName = 2;
}

Originally created by @GomesNayagam on GitHub (Apr 21, 2025). Originally assigned to: @StefH on GitHub. ### Describe the bug @StefH Unimplemented error because, the response string is not matching. ### Expected behavior: Should deserialize response string and no error, All works if i revert the package to 1.6.8. ### Test to reproduce ```c# var protoBufJsonMatcher5 = new JsonPartialWildcardMatcher( "{\"Client\":{\"CorrelationId\":\"*\"}}", false, true ); var res3 = JsonConvert.DeserializeObject( "{\"Status\":{\"HasErrors\":false,\"HasWarnings\":false,\"Errors\":[],\"Warnings\":[],\"CorrelationId\":\"b8ad0d04-ed2f-42e1-ac85-339d91dc9855\"},\"CancellationCode\":\"\",\"CancellationName\":\"\",\"CancellationDescription\":\"\",\"CancellationEffDate\":null,\"NonRenewalCode\":\"\",\"NonRenewalName\":\"\",\"NonRenewalDescription\":\"\",\"NonRenewalEffDate\":null,\"LastReinstatementDate\":null}" ); server //.AddProtoDefinition(id, protoDefinitionText) .Given( Request .Create() .UsingPost() .WithHttpVersion("2") .WithPath("/Policy2.PolicyService2/GetCancellationDetail") .WithBodyAsProtoBuf( protoDefinition, "Policy2.GetCancellationDetailRequest", protoBufJsonMatcher5 ) ) .WithProtoDefinition(id) .RespondWith( Response .Create() .WithHeader("Content-Type", "application/grpc") .WithTrailingHeader("grpc-status", "0") .WithBodyAsProtoBuf( protoDefinition, "Policy2.GetCancellationDetailResponse", res3! ) .WithTransformer() ); var reply4 = await client.GetCancellationDetailAsync( new Policy2.GetCancellationDetailRequest { Client = cl } ); ``` ### Other related info .proto file: ```proto syntax = "proto3"; import "google/protobuf/timestamp.proto"; // option csharp_namespace = "NarrowIntegrationTest.Lookup"; package Policy2; service PolicyService2 { rpc GetVersion (GetVersionRequest) returns (GetVersionResponse); rpc GetVersion2 (GetVersion2Request) returns (GetVersion2Response); rpc GetHolidayCalendar (GetHolidayCalendarRequest) returns (GetHolidayCalendarResponse); rpc GetCancellationDetail (GetCancellationDetailRequest) returns (GetCancellationDetailResponse); } // REQUEST/RESPONSE DEFINITIONS message GetCancellationDetailRequest { Client Client = 1; LegacyPolicyKey LegacyPolicyKey = 2; } message GetCancellationDetailResponse { ResponseStatus Status = 1; string CancellationCode = 2; string CancellationName = 3; string CancellationDescription = 4; google.protobuf.Timestamp CancellationEffDate = 5; string NonRenewalCode = 6; string NonRenewalName = 7; string NonRenewalDescription = 8; google.protobuf.Timestamp NonRenewalEffDate = 9; google.protobuf.Timestamp LastReinstatementDate = 10; // Always send the last reinstatement date if present on the policy term. } message LegacyPolicyKey { string Group = 1; int32 UnitNumber = 2; int32 Year = 3; string Suffix = 4; } message ResponseStatus { bool HasErrors = 1; bool HasWarnings =2; repeated string Errors = 3; repeated string Warnings = 4; string CorrelationId = 5; } message Client { string CorrelationId = 1; enum Clients { Unknown = 0; QMS = 1; BillingCenter = 2; PAS = 3; Payroll = 4; Portal = 5; SFO = 6; QuoteAndBind = 7; LegacyConversion = 8; BindNow = 9; PaymentPortal = 10 ; PricingEngine = 11; } Clients ClientName = 2; } ```
adam added the bug label 2025-12-29 15:30:50 +01:00
adam closed this issue 2025-12-29 15:30:50 +01:00
Author
Owner

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

@StefH this is breaking between version 1.6.11 => 1.6.12

@GomesNayagam commented on GitHub (May 9, 2025): @StefH this is breaking between version 1.6.11 => 1.6.12
Author
Owner

@StefH commented on GitHub (May 10, 2025):

https://github.com/StefH/ProtoBufJsonConverter/pull/27

@StefH commented on GitHub (May 10, 2025): https://github.com/StefH/ProtoBufJsonConverter/pull/27
Author
Owner

@StefH commented on GitHub (May 10, 2025):

https://github.com/WireMock-Net/WireMock.Net/pull/1293

@StefH commented on GitHub (May 10, 2025): https://github.com/WireMock-Net/WireMock.Net/pull/1293
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#686