Skip to content

Implementing opaque fields#8

Merged
giograno merged 1 commit into
mainfrom
skip-fields
Nov 7, 2025
Merged

Implementing opaque fields#8
giograno merged 1 commit into
mainfrom
skip-fields

Conversation

@giograno
Copy link
Copy Markdown
Member

@giograno giograno commented Nov 5, 2025

In our application, we might want to "disable" Avro schema for some fields.
Unfortunately, we can't completely ignore a field (similar to what transient does in the Java world) but we can simply tell Avro to serialize everything to a string.

We introducing the type Opaque that, used in combination with Annotated, tells py-avro reduce everything to a string.
For this to work end-to-end, we need to implement a similar logic in our ObjectSerializer (see comment below).

💡 : we have being adding features working across this repo and the mapper component in LocalStack. In the future, we might want to either have an external comprehensive library with both components, or internalize everything.

Related to PNX-443

@giograno giograno requested review from bentsku and thrau November 5, 2025 15:41
@giograno giograno self-assigned this Nov 5, 2025
@giograno giograno marked this pull request as ready for review November 6, 2025 08:34
Copy link
Copy Markdown
Member

@thrau thrau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i like this approach! i didn't actually know about typing.Annotated, nice find! i love that there's still things to learn about python :D

we should give this a try, but i'd love to see a concrete example from localstack soon so we can decide whether this is the way forward.

remember that these types of changes will proliferate through the entire codebase

@giograno giograno merged commit cf07b83 into main Nov 7, 2025
6 checks passed
@giograno giograno deleted the skip-fields branch November 7, 2025 16:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants