@@ -61,7 +61,10 @@ def as_dict(self):
6161 out [prop ] = [getattr (x , "for_json" , lambda : x )() for x in propval ]
6262 elif isinstance (propval , (ProtocolBase , LiteralValue )):
6363 out [prop ] = propval .as_dict ()
64- elif propval is not None :
64+ elif (
65+ propval is not None
66+ or self .__propinfo__ [prop ].get ("type" , None ) == "null"
67+ ):
6568 out [prop ] = propval
6669
6770 return out
@@ -150,9 +153,6 @@ def __new__(cls, **props):
150153 obj = None
151154 validation_errors = []
152155 for klass in valid_types :
153- logger .debug (
154- util .lazy_format ("Attempting to instantiate {0} as {1}" , cls , klass )
155- )
156156 try :
157157 obj = klass (** props )
158158 obj .validate ()
@@ -170,6 +170,7 @@ def __new__(cls, **props):
170170 return obj
171171
172172 def __init__ (self , ** props ):
173+ logger .debug (util .lazy_format ("Creating '{0}'" , self .__class__ ))
173174 self ._extended_properties = dict ()
174175 self ._properties = dict (
175176 zip (
@@ -648,6 +649,14 @@ def _build_object(self, nm, clsdata, parents, **kw):
648649
649650 # Set default value, even if None
650651 if "default" in detail :
652+ logger .debug (
653+ util .lazy_format (
654+ "Setting default for {0}.{1} to: {2}" ,
655+ nm ,
656+ prop ,
657+ detail ["default" ],
658+ )
659+ )
651660 defaults .add (prop )
652661
653662 if detail .get ("type" , None ) == "object" :
0 commit comments