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

Azure EventHub - EventData.body_as_json returns a dict #29044

Closed
ivandigiusto opened this issue Feb 27, 2023 · 2 comments
Closed

Azure EventHub - EventData.body_as_json returns a dict #29044

ivandigiusto opened this issue Feb 27, 2023 · 2 comments
Assignees
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that

Comments

@ivandigiusto
Copy link

EventData.body_as_json in Azure EventHub code currently returns a dictionary. This is not expected based on the name, as what is expected (in Python) is a string representing a json object.

Since there is already body_as_str method, I would suggest that this method gets renamed as body_as_dict.

In the interim, it could be kept for backwards compatibility, but it is not intuitive for new users of this module.

In Python, JSON != dict, at least not as a type. That is why we use json.loads to move JSON into a dict.

@ghost ghost added customer-reported Issues that are reported by GitHub users external to the Azure organization. question The issue doesn't require a change to the product in order to be resolved. Most issues start as that labels Feb 27, 2023
@github-actions github-actions bot added the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 27, 2023
@kashifkhan
Copy link
Member

Thanks for the feedback @ivandigiusto . We will investigate and get back to you asap.

@kashifkhan kashifkhan self-assigned this Feb 28, 2023
@github-actions github-actions bot removed the needs-triage Workflow: This is a new issue that needs to be triaged to the appropriate team. label Feb 28, 2023
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Feb 28, 2023
@kashifkhan kashifkhan added Messaging Messaging crew and removed needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team labels Feb 28, 2023
@ghost ghost added the needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team label Feb 28, 2023
@kashifkhan
Copy link
Member

Hi @ivandigiusto, thank you for the issue and sorry for taking so long to get back to you on this. You are right that there is some confusion, and we can improve things by enhancing the description of the method & adding a code snippet showing how to get the actual string, while leaving the method intact given that it has been in GA for a number of years now.

Defining json object as a type in python has quite the interesting read here so a dict[str, any] can be a json type just as a str.

Thank you 🙂

@github-actions github-actions bot locked and limited conversation to collaborators Jun 25, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
customer-reported Issues that are reported by GitHub users external to the Azure organization. Event Hubs Messaging Messaging crew needs-team-attention Workflow: This issue needs attention from Azure service team or SDK team question The issue doesn't require a change to the product in order to be resolved. Most issues start as that
Projects
None yet
Development

No branches or pull requests

4 participants