Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enum schema evolution #344

Merged
merged 3 commits into from
Jan 18, 2024

Conversation

redaLaanait
Copy link
Contributor

@redaLaanait redaLaanait commented Jan 17, 2024

fixes: #340

@redaLaanait redaLaanait changed the title fix: fix enum schema evolution fix: enum schema evolution Jan 17, 2024
Copy link
Member

@nrwiersma nrwiersma left a comment

Choose a reason for hiding this comment

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

Looks good, perhaps a test to prove it will substitute the default when the writers symbol is missing, stopping any regression here?

@redaLaanait
Copy link
Contributor Author

I think this one does cover the case:

 {
    name: "Enum Reader Missing Symbols With Default",
    reader: `{
        "type": "enum",
        "name": "test.enum",
        "symbols": ["foo"],
        "default": "foo"
    }`,
    writer: `{
        "type": "enum",
        "name": "test.enum",
        "symbols": ["foo", "bar"]
    }`,
    value: "bar",
    want:  "foo",
}

Do I understand the remark correctly?

@nrwiersma
Copy link
Member

You are correct, I missed that this does an Unmarshal.

Copy link
Member

@nrwiersma nrwiersma left a comment

Choose a reason for hiding this comment

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

LGTM 🎉

@nrwiersma nrwiersma merged commit 23b5cc1 into hamba:main Jan 18, 2024
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Enum schema evolution for missing value in reader schema but with default
2 participants