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

Fix model serialization#220

Merged
lmazuel merged 2 commits intoAzure:masterfrom
rakshith91:ser_obj
Sep 2, 2020
Merged

Fix model serialization#220
lmazuel merged 2 commits intoAzure:masterfrom
rakshith91:ser_obj

Conversation

@rakshith91
Copy link

@rakshith91 rakshith91 commented Aug 27, 2020

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)

Fixes Azure/azure-sdk-for-python#12831

@codecov-commenter
Copy link

codecov-commenter commented Aug 27, 2020

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 Files Coverage Δ
msrest/serialization.py 90.80% <100.00%> (-0.30%) ⬇️
msrest/configuration.py 75.86% <0.00%> (-2.27%) ⬇️
msrest/universal_http/requests.py 82.01% <0.00%> (-0.74%) ⬇️
msrest/paging.py 91.22% <0.00%> (-0.30%) ⬇️
msrest/exceptions.py 87.34% <0.00%> (-0.16%) ⬇️
msrest/universal_http/__init__.py 74.09% <0.00%> (-0.15%) ⬇️
msrest/pipeline/universal.py 94.11% <0.00%> (-0.12%) ⬇️
msrest/pipeline/__init__.py 91.20% <0.00%> (+0.57%) ⬆️
msrest/pipeline/async_abc.py 91.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 lmazuel merged commit 5343547 into Azure:master Sep 2, 2020
Sign up for free to 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