Skip to content
This repository was archived by the owner on Feb 28, 2026. It is now read-only.

Fix model serialization - #220

Merged
Laurent Mazuel (lmazuel) merged 2 commits into
Azure:masterfrom
rakshith91:ser_obj
Sep 2, 2020
Merged

Fix model serialization#220
Laurent Mazuel (lmazuel) merged 2 commits into
Azure:masterfrom
rakshith91:ser_obj

Conversation

@rakshith91

@rakshith91Rakshith Bhyravabhotla (rakshith91) commented Aug 27, 2020

Copy link
Copy Markdown

msrest serializes objects as a string rather than dictionary

Please look at Azure/azure-sdk-for-python#12831

class CustomSample(msrest.serialization.Model):
_validation = {
'a': {'required': True},
}
_attribute_map = {
'a': {'key': 'a', 'type': 'str'},
}
def __init__(self, a):
self.a = a

would be serialized as 'data': "{'a': 'sample event'}", (as an instance of string rather than dict)

FixesAzure/azure-sdk-for-python#12831

@codecov-commenter

Codecov Comments Bot (codecov-commenter) commented Aug 27, 2020

Copy link
Copy Markdown

Codecov Report

Merging #220 into master will decrease coverage by 0.15%.
The diff coverage is 100.00%.

Impacted file tree graph

@@ Coverage Diff @@## master #220 +/- ##
==========================================
- Coverage 86.22% 86.06% -0.16% 
==========================================
Files 25 25 Lines 2736 2677 -59 ==========================================
- Hits 2359 2304 -55 + Misses 377 373 -4 
Impacted FilesCoverage Δ
msrest/serialization.py90.80% <100.00%> (-0.30%)⬇️
msrest/configuration.py75.86% <0.00%> (-2.27%)⬇️
msrest/universal_http/requests.py82.01% <0.00%> (-0.74%)⬇️
msrest/paging.py91.22% <0.00%> (-0.30%)⬇️
msrest/exceptions.py87.34% <0.00%> (-0.16%)⬇️
msrest/universal_http/__init__.py74.09% <0.00%> (-0.15%)⬇️
msrest/pipeline/universal.py94.11% <0.00%> (-0.12%)⬇️
msrest/pipeline/__init__.py91.20% <0.00%> (+0.57%)⬆️
msrest/pipeline/async_abc.py91.42% <0.00%> (+1.28%)⬆️
... and 1 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 76a4149...939800c. Read the comment docs.

@lmazuel
Laurent Mazuel (lmazuel) merged commit 5343547 into Azure:masterSep 2, 2020
Sign up for freeto subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

msrest.serialization serializes CloudEvent data field object as string

4 participants

@rakshith91@codecov-commenter@lmazuel@KieranBrantnerMagee