Azure / msrest-for-python

The runtime library "msrest" for AutoRest generated Python clients.
MIT License
41 stars 64 forks source link

Fix model serialization #220

Closed rakshith91 closed 4 years ago

rakshith91 commented 4 years ago

msrest serializes objects as a string rather than dictionary

Please look at https://github.com/Azure/azure-sdk-for-python/issues/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 https://github.com/Azure/azure-sdk-for-python/issues/12831

codecov-commenter commented 4 years ago

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%) :arrow_down:
msrest/configuration.py 75.86% <0.00%> (-2.27%) :arrow_down:
msrest/universal_http/requests.py 82.01% <0.00%> (-0.74%) :arrow_down:
msrest/paging.py 91.22% <0.00%> (-0.30%) :arrow_down:
msrest/exceptions.py 87.34% <0.00%> (-0.16%) :arrow_down:
msrest/universal_http/__init__.py 74.09% <0.00%> (-0.15%) :arrow_down:
msrest/pipeline/universal.py 94.11% <0.00%> (-0.12%) :arrow_down:
msrest/pipeline/__init__.py 91.20% <0.00%> (+0.57%) :arrow_up:
msrest/pipeline/async_abc.py 91.42% <0.00%> (+1.28%) :arrow_up:
... 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.