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: wrong return from get and list for migration #33

Closed
wants to merge 1 commit into from

Conversation

gene-redpanda
Copy link
Contributor

After a change in the API, GetMigration and ListMigration were improperly returning values that only supported outbound migrations.

The tricky bit here was that MigrationState could hold either an Inbound or an Outbound in the Migration field.

To deal with this I used a json.RawMessage to hold the field's contents temporarily. Alternative approaches resulted in a field full of horrifying nested maps no developer was ever meant to see.

Once we have the RawMessage we can properly unmarshal it and return things. The end user should have an easier time as they can call GetMigrationType() and then type assert to the correct value.

After a change in the API, GetMigration and ListMigration were improperly returning values that only supported outbound migrations.

The tricky bit here was that MigrationState could hold either an Inbound or an Outbound in the Migration field.

To deal with this I used a json.RawMessage to hold the field's contents temporarily. Alternative approaches resulted in a field full of horrifying nested maps no developer was ever meant to see.

Once we have the RawMessage we can properly unmarshal it and return things. The end user should have an easier time as they can call GetMigrationType() and then type assert to the correct value.
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.

1 participant