Hi Daniel,

Would you like to send a Pull Request with the fix and a test case ?
Thank you!

Martin


On Wed, Apr 26, 2023 at 8:13 AM Daniel Young <[email protected]> wrote:

> Hi,
> I believe there is an issue with the python library supporting a schema
> with optional UUIDs.
> The field should look like:
>
> "fields": [
>     {
>       "name": "userId",
>       "type": [
>         "null",
>         {
>           "type": "string",
>           "logicalType": "uuid"
>         }
>       ]
>     }
>
> ]
>
> but currently that does not validate with a userId: None and gives a
> TypeError exception.
>
> I believe the fix is to catch TypeError here:
> https://github.com/apache/avro/blob/master/lang/py/avro/schema.py#L1046
> in the same way that ValueError is caught. Anything that doesn't match the
> appropriate UUID type is guaranteed to not be a UUID.
> I didn't find this in the issue tracker.
> Thanks,
> Daniel Young

Reply via email to