Return-Path: X-Original-To: apmail-deltacloud-dev-archive@www.apache.org Delivered-To: apmail-deltacloud-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 7FF88E109 for ; Wed, 27 Feb 2013 04:20:14 +0000 (UTC) Received: (qmail 80347 invoked by uid 500); 27 Feb 2013 04:20:14 -0000 Delivered-To: apmail-deltacloud-dev-archive@deltacloud.apache.org Received: (qmail 80078 invoked by uid 500); 27 Feb 2013 04:20:13 -0000 Mailing-List: contact dev-help@deltacloud.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@deltacloud.apache.org Delivered-To: mailing list dev@deltacloud.apache.org Received: (qmail 80030 invoked by uid 99); 27 Feb 2013 04:20:12 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Feb 2013 04:20:12 +0000 Date: Wed, 27 Feb 2013 04:20:12 +0000 (UTC) From: "David Lutterkort (JIRA)" To: dev@deltacloud.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (DTACLOUD-499) The 'ref' attributes are not (de)serialized properly when used in array MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/DTACLOUD-499?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13587988#comment-13587988 ] David Lutterkort commented on DTACLOUD-499: ------------------------------------------- To produce an array of references you would write array :volume_templates, :ref => CIMI::Model::VolumeTemplate though for MachineTemplate, things are a little messier, since the entry in the volume_templates array is basically a VolumeTemplate with an additional attribute (initialLocation). For that, you'd have to do (leaving out the CIMI::Model prefix) class VolumeTemplateWithLocation < VolumeTemplate text :initial_location end class MachineTemplate < Base array :volume_templates, :ref => VolumeTemplateWithLocation end At least, that's my reading of the spec .. somewhat ugly. Might want to ask the working group to calrify. > The 'ref' attributes are not (de)serialized properly when used in array > ----------------------------------------------------------------------- > > Key: DTACLOUD-499 > URL: https://issues.apache.org/jira/browse/DTACLOUD-499 > Project: DeltaCloud > Issue Type: Bug > Components: CIMI/Frontend > Reporter: Michal Fojtik > Assignee: David Lutterkort > Attachments: 0001-CIMI-schema-make-it-possible-to-build-an-array-of-re.patch, 0001-Sample-test.patch > > > If you have this definition in CIMI model (MachineTemplate in this case): > array :volume_templates do > ref :volume_template > end > and you use this JSON in .from_json method to create an instance of the MachineTemplate: > > 'volume_templates' : [ > { 'volumeConfig' : { 'capacity' : '12345' } } > ] > > The resulting 'machine_template.volume_templates.first.volume_config.capacity' will be 'nil'. > I tried to play a bit with the input JSON and I found that if you use this: > > 'volume_templates' : [ > 'volume_template' : { > { 'volumeConfig' : { 'capacity' : '12345' } } > } > ] > > The resulting 'machine_template.volume_templates.first.volume_template.capacity' is set properly to '12345' :-) > The XML output then looks like: > > > > > 10240 > > > > > I think we need to do something smart in the 'array' to remove the upper 'volumeTemplate' or introduce something like 'ref_arr :volume_templates'. > Anyway, I'm leaving this one to you David, as you might have better schema knowledge than me ;-) > CC'ing Dies, as he reported this issue original in his email. -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira