[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH V4 11/24] libxl/gentypes.py: include discriminator in JSON output



On Wed, May 07, 2014 at 11:00:26AM +0100, Ian Campbell wrote:
> On Tue, 2014-05-06 at 14:09 +0100, Wei Liu wrote:
> > On Tue, May 06, 2014 at 02:03:49PM +0100, Ian Campbell wrote:
> > > On Thu, 2014-05-01 at 13:58 +0100, Wei Liu wrote:
> > > > Parser relies on the discriminator to go to correct branch.
> > > > 
> > > > Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
> > > 
> > > Acked-by: Ian Campbell <ian.campbell@citrix>
> > > 
> > > But, an idea: What about calling the field which refers to the union by
> > > it's discriminated name, i.e. "u.pv": { map of things } instead of
> > > "type": "pv", "u" { map of things } ?
> 
> > But that breaks API, doesn't it?
> 
> Doh, yes.
> 
> > If we can safely assume that there's no
> > existing user of this JSON API, changing it won't be hard.
> 
> Is it even possible to sanely use things as they are? The existence of
> this patch would seem to suggest not?
> 

There's actual a horrible way to hack around current implementation: if
you calculate the intersection of those fields in "pv" and "hvm" you can
actually discriminate things. Not sure if a sane person would do it
though! However I would rather stay on the safe side.

Wei.

> Ian.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.