← Back to team overview

openstack team mailing list archive

Re: Just JSON, and extensibility

 

>
>
>>    - Each (known) extension has its own strongly-typed model object.
>>
>>
> Does that mean that an extension cannot add properties to an existing
> object (such as adding a new attribute an Image), or just that all of those
> properties will be an a nested object (such as
> Image.my_extension.my_attribute)?
>

Good point - I should clarify...  I'm not using the standard Java XML
binding code here, because they would require a wrapping object.  It's
using custom code to do the binding whenever data from a different
namespace is encountered, although it uses the standard JAXB annotations to
guide it.  From the user's point of view, "it just works"; the
implementation is not as nice :-)

Because we're not wrapping our extensions in their own elements, I didn't
know how to get the standard tooling to work with it anyway.  Interesting
data-point for the "standard tools" argument...


> Now, how you would do something that awesome in Python, I don't know ;-)
>>
>
> Probably the same way. I would use setuptools entry points to map
> namespace prefixes to the class, so the client could load the handler
> automatically when it encounters data it does not recognize.
>

Yes - I should have said "dictionary" rather than "registry"!  Are you
doing this in python-novaclient?  Awesome!

Follow ups

References