Hi all,

Recently I found the default generated schema definition in the Python
client is different from the Java client, which leads to some
unexpected behavior.

For example, given the following class definition in Python:

```python
class Data(Record):
    i = Integer()
```

The type of `i` field is a union: "type": ["null", "int"]

While given the following class definition in Java:

```java
class Data {
    private final int i;
    /* ... */
}
```

The type of `i` field is an integer: "type": "int"

It brings an issue that if a Python consumer subscribes to a topic
with schema defined above, then a Java producer will fail to create
because of the schema incompatibility.

Currently, the workaround is to change the schema compatibility
strategy to FORWARD.

Should we change the way to generate schema definition in the Python
client to be compatible with the Java client? It could bring breaking
changes to old Python clients, but it could guarantee compatibility
with the Java client.

If not, we still have to introduce an extra configuration to make
Python schema compatible with Java schema. But it requires code
changes. e.g. here is a possible solution:

```python
class Data(Record):
    # NOTE: Users might have to add this extra field to control how to
generate the schema
    __java_compatible = True
    i = Integer()
```

Thanks,
Yunze

Reply via email to