Azure / msrest-for-python

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

Raise DeserializationError on bad discriminator usage #27

Closed lmazuel closed 7 years ago

lmazuel commented 7 years ago

Was supposed to fix https://github.com/Azure/msrest-for-python/issues/26, but finally the discriminator must not be absent or null (and obviously not an unexpected value).

Raise a more easy to read exception, so that problem is more obvious to catch.

codecov-io commented 7 years ago

Codecov Report

Merging #27 into master will increase coverage by 0.65%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #27      +/-   ##
==========================================
+ Coverage    88.2%   88.86%   +0.65%     
==========================================
  Files          10       10              
  Lines        1280     1239      -41     
==========================================
- Hits         1129     1101      -28     
+ Misses        151      138      -13
Impacted Files Coverage Δ
msrest/serialization.py 90.35% <100%> (-0.02%) :arrow_down:
msrest/__init__.py 58.33% <0%> (-7.06%) :arrow_down:

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 02b1e35...40a6170. Read the comment docs.

lmazuel commented 7 years ago

Added a discriminator fix to allow to instantiate the base class. Will work only if the value is the class name, "x-ms-discriminator-name" Autorest extension is broken at the Autorest level for a base class, needs to be fixed in the core (@amarzavery for details)