From 6885b2a923ec694cee071f97232efd12c6c210d8 Mon Sep 17 00:00:00 2001 From: Santiago Jimenez Giraldo Date: Fri, 31 Jan 2025 16:48:25 +0100 Subject: [PATCH] fix: do not return repeated directly Use the complete response when the response is a list Signed-off-by: Santiago Jimenez Giraldo --- .../api/dataplane/v1alpha2/topic.pb.go | 23 +++++------ .../api/dataplane/v1alpha2/topic.pb.gw.go | 39 +++---------------- .../api/dataplane/v1alpha2/topic.proto | 7 +--- 3 files changed, 17 insertions(+), 52 deletions(-) diff --git a/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.go b/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.go index 1895854db..59ea3ac3a 100644 --- a/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.go +++ b/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.go @@ -1428,7 +1428,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x2e, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, - 0x73, 0x32, 0xd5, 0x13, 0x0a, 0x0c, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, + 0x73, 0x32, 0xa5, 0x13, 0x0a, 0x0c, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x53, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x12, 0xe1, 0x02, 0x0a, 0x0b, 0x43, 0x72, 0x65, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x12, 0x33, 0x2e, 0x72, 0x65, 0x64, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, @@ -1492,7 +1492,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x73, 0x74, 0x12, 0x16, 0x0a, 0x14, 0x1a, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x19, 0x2a, 0x17, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2f, 0x74, 0x6f, 0x70, 0x69, - 0x63, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0xa0, 0x03, 0x0a, 0x16, 0x47, 0x65, + 0x63, 0x73, 0x2f, 0x7b, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x12, 0x90, 0x03, 0x0a, 0x16, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3e, 0x2e, 0x72, 0x65, 0x64, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, @@ -1502,7 +1502,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x61, 0x70, 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x47, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, - 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x84, 0x02, 0x92, 0x41, 0xbc, 0x01, 0x12, 0x18, 0x47, 0x65, + 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0xf4, 0x01, 0x92, 0x41, 0xbc, 0x01, 0x12, 0x18, 0x47, 0x65, 0x74, 0x20, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x20, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x22, 0x47, 0x65, 0x74, 0x20, 0x6b, 0x65, 0x79, 0x2d, 0x76, 0x61, 0x6c, 0x75, 0x65, 0x20, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x73, 0x20, 0x66, 0x6f, @@ -1514,11 +1514,10 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4a, 0x2a, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x23, 0x0a, 0x09, 0x4e, 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x14, 0x1a, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, - 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x62, 0x0e, - 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x2c, + 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x2e, 0x12, 0x2c, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x63, 0x6f, - 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xc8, 0x03, 0x0a, + 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xb8, 0x03, 0x0a, 0x19, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x41, 0x2e, 0x72, 0x65, 0x64, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, @@ -1529,7 +1528,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, - 0x65, 0x22, 0xa3, 0x02, 0x92, 0x41, 0xcb, 0x01, 0x12, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, + 0x65, 0x22, 0x93, 0x02, 0x92, 0x41, 0xcb, 0x01, 0x12, 0x1a, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x20, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x1a, 0x2c, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x61, 0x20, 0x73, 0x75, 0x62, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, 0x74, 0x68, 0x65, 0x20, 0x74, 0x6f, 0x70, @@ -1542,12 +1541,11 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x4a, 0x2a, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x23, 0x0a, 0x09, 0x4e, 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x14, 0x1a, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, - 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x4e, 0x3a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, - 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, + 0x74, 0x75, 0x73, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x3a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x32, 0x2c, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, - 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xb9, 0x04, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x54, + 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0xa9, 0x04, 0x0a, 0x16, 0x53, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3e, 0x2e, 0x72, 0x65, 0x64, 0x70, 0x61, 0x6e, 0x64, 0x61, 0x2e, 0x61, 0x70, 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, @@ -1557,7 +1555,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x69, 0x2e, 0x64, 0x61, 0x74, 0x61, 0x70, 0x6c, 0x61, 0x6e, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2e, 0x53, 0x65, 0x74, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, - 0x6e, 0x73, 0x65, 0x22, 0x9d, 0x03, 0x92, 0x41, 0xc5, 0x02, 0x12, 0x18, 0x53, 0x65, 0x74, 0x20, + 0x6e, 0x73, 0x65, 0x22, 0x8d, 0x03, 0x92, 0x41, 0xc5, 0x02, 0x12, 0x18, 0x53, 0x65, 0x74, 0x20, 0x54, 0x6f, 0x70, 0x69, 0x63, 0x20, 0x43, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0xaa, 0x01, 0x55, 0x70, 0x64, 0x61, 0x74, 0x65, 0x20, 0x74, 0x68, 0x65, 0x20, 0x65, 0x6e, 0x74, 0x69, 0x72, 0x65, 0x20, 0x73, 0x65, 0x74, 0x20, 0x6f, 0x66, 0x20, @@ -1578,8 +1576,7 @@ var file_redpanda_api_dataplane_v1alpha2_topic_proto_rawDesc = []byte{ 0x6e, 0x73, 0x65, 0x4a, 0x2a, 0x0a, 0x03, 0x34, 0x30, 0x34, 0x12, 0x23, 0x0a, 0x09, 0x4e, 0x6f, 0x74, 0x20, 0x46, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x16, 0x0a, 0x14, 0x1a, 0x12, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x72, 0x70, 0x63, 0x2e, 0x53, 0x74, 0x61, 0x74, 0x75, 0x73, 0x82, - 0xd3, 0xe4, 0x93, 0x02, 0x4e, 0x3a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, - 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x62, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, + 0xd3, 0xe4, 0x93, 0x02, 0x3e, 0x3a, 0x0e, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x1a, 0x2c, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x32, 0x2f, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x73, 0x2f, 0x7b, 0x74, 0x6f, 0x70, 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x7d, 0x2f, 0x63, 0x6f, 0x6e, 0x66, 0x69, 0x67, 0x75, 0x72, 0x61, 0x74, 0x69, diff --git a/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.gw.go b/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.gw.go index ce619ab9a..6a57baa1f 100644 --- a/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.gw.go +++ b/backend/pkg/protogen/redpanda/api/dataplane/v1alpha2/topic.pb.gw.go @@ -461,7 +461,7 @@ func RegisterTopicServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_GetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_GetTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_GetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -486,7 +486,7 @@ func RegisterTopicServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_UpdateTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_UpdateTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_UpdateTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -511,7 +511,7 @@ func RegisterTopicServiceHandlerServer(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_SetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_SetTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_SetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -640,7 +640,7 @@ func RegisterTopicServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_GetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_GetTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_GetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -662,7 +662,7 @@ func RegisterTopicServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_UpdateTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_UpdateTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_UpdateTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) @@ -684,40 +684,13 @@ func RegisterTopicServiceHandlerClient(ctx context.Context, mux *runtime.ServeMu return } - forward_TopicService_SetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, response_TopicService_SetTopicConfigurations_0{resp}, mux.GetForwardResponseOptions()...) + forward_TopicService_SetTopicConfigurations_0(annotatedContext, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) }) return nil } -type response_TopicService_GetTopicConfigurations_0 struct { - proto.Message -} - -func (m response_TopicService_GetTopicConfigurations_0) XXX_ResponseBody() interface{} { - response := m.Message.(*GetTopicConfigurationsResponse) - return response.Configurations -} - -type response_TopicService_UpdateTopicConfigurations_0 struct { - proto.Message -} - -func (m response_TopicService_UpdateTopicConfigurations_0) XXX_ResponseBody() interface{} { - response := m.Message.(*UpdateTopicConfigurationsResponse) - return response.Configurations -} - -type response_TopicService_SetTopicConfigurations_0 struct { - proto.Message -} - -func (m response_TopicService_SetTopicConfigurations_0) XXX_ResponseBody() interface{} { - response := m.Message.(*SetTopicConfigurationsResponse) - return response.Configurations -} - var ( pattern_TopicService_CreateTopic_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1alpha2", "topics"}, "")) diff --git a/proto/redpanda/api/dataplane/v1alpha2/topic.proto b/proto/redpanda/api/dataplane/v1alpha2/topic.proto index 0e4acd51b..142e04e17 100644 --- a/proto/redpanda/api/dataplane/v1alpha2/topic.proto +++ b/proto/redpanda/api/dataplane/v1alpha2/topic.proto @@ -292,10 +292,7 @@ service TopicService { }; } rpc GetTopicConfigurations(GetTopicConfigurationsRequest) returns (GetTopicConfigurationsResponse) { - option (google.api.http) = { - get: "/v1alpha2/topics/{topic_name}/configurations" - response_body: "configurations" - }; + option (google.api.http) = {get: "/v1alpha2/topics/{topic_name}/configurations"}; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Get Topic Configurations" description: "Get key-value configs for a topic." @@ -323,7 +320,6 @@ service TopicService { option (google.api.http) = { patch: "/v1alpha2/topics/{topic_name}/configurations" body: "configurations" - response_body: "configurations" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Update Topic Configuration" @@ -352,7 +348,6 @@ service TopicService { option (google.api.http) = { put: "/v1alpha2/topics/{topic_name}/configurations" body: "configurations" - response_body: "configurations" }; option (grpc.gateway.protoc_gen_openapiv2.options.openapiv2_operation) = { summary: "Set Topic Configurations"