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

Change is_decodable/1 to decodable?/1 #138

Merged
merged 4 commits into from
Jan 27, 2025

Conversation

azeemchauhan
Copy link
Contributor

Addressing #132

Summary

  • Deprecate is_decodable/1 and follow new naming convention decodable?/1
  • Log a warning message when is_decodable/1 is used.

@azeemchauhan azeemchauhan changed the title Change is_decodable to decodable? Change is_decodable/1 to decodable?/1 Jan 22, 2025
@azeemchauhan azeemchauhan changed the title Change is_decodable/1 to decodable?/1 Change is_decodable/1 to decodable?/1 Jan 22, 2025
Copy link
Owner

@Strech Strech left a comment

Choose a reason for hiding this comment

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

Thanks for your support @azeemchauhan I appreciate it!

I would like to make few adjustments to reduce the risk of mistake.

Comment on lines 20 to 25
@doc """
Checks whether a given binary Avro message is decodable with the Plain codec.

This function is deprecated and will be removed in future release.
Please use `Avrora.Codec.Plain.decodable?/1` instead.
"""
Copy link
Owner

Choose a reason for hiding this comment

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

Could you delete the documentation @doc false and use @deprecated "Use ... instead"

Logger.warning(
"`Avrora.Codec.ObjectContainerFile.is_decodable/1` is deprecated, use `Avrora.Codec.ObjectContainerFile.decodable?/1` instead"
)

case payload do
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please replace the code with a call of decodable? instead of duplication

def is_decodable(payload) when is_binary(payload) do
Logger.warning("`Avrora.Codec.Plain.is_decodable/1` is deprecated, use `Avrora.Codec.Plain.decodable?/1` instead")

true
Copy link
Owner

Choose a reason for hiding this comment

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

Could you please re-use new function instead?

false
"""
@callback decodable?(payload :: binary()) :: boolean

@doc deprecated: "Use `Avrora.Codec.Plain.decodable?/1` instead."
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@callback can deprecated using soft-deprecation: e.g
image

@azeemchauhan azeemchauhan requested a review from Strech January 24, 2025 12:09
@Strech Strech merged commit ed27101 into Strech:master Jan 27, 2025
9 checks passed
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