dajac commented on a change in pull request #9318:
URL: https://github.com/apache/kafka/pull/9318#discussion_r497375844



##########
File path: core/src/main/resources/common/message/OffsetCommitRequest.json
##########
@@ -0,0 +1,37 @@
+// Licensed to the Apache Software Foundation (ASF) under one or more
+// contributor license agreements.  See the NOTICE file distributed with
+// this work for additional information regarding copyright ownership.
+// The ASF licenses this file to You under the Apache License, Version 2.0
+// (the "License"); you may not use this file except in compliance with
+// the License.  You may obtain a copy of the License at
+//
+//    http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+{
+  "name": "OffsetCommitRequest",
+  "validVersions": "0-1",
+  "fields": [
+    {
+      "name": "group",
+      "versions": "0+",

Review comment:
       I have though about doing this as well and I am not fully convinced by 
it. What do we gain by doing so? It sounds a bit confusing and error prone as 
one without the historical context may do mistakes while evolving the two 
schemas in the future. Moreover, as we still have logic in the code which 
relies on the version to build up the correct object, we don't gain that much 
there neither.
   
   As an example, let imagine that we want to add new field `foo` to 
`GroupMetadata` part of the schema and a new field `bar` to `OffsetCommit` 
part. We would end up with the following:
   
   ```
   {
     "type": "data",
     "name": "OffsetCommitKey",
     "validVersions": "0-4",
     "fields": [
       { "name": "group", "type": "string", "versions": "0-4" },
       { "name": "topic", "type": "string", "versions": "0-1, 4" },
       { "name": "partition", "type": "int32", "versions": "0-1, 4" }
       { "name": "foo", "type": "int32", "versions": "3" }
       { "name": "bar", "type": "int32", "versions": "0-1, 4" }
     ]
   }
   ```
   
   v3 would be the new version of the `GroupMetadata` part and v4 the new 
version of the `OffsetCommit`.
   
   Personally, I find this hard to reason about because it is not easy to see 
that there are in fact two distinct-overlapping schemas in there which shares 
the `group` field. I lean towards keeping two separate schemas for the time 
being. I think that we can revise this when we will have to evolve them.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to