Change in ovirt-engine[master]: restapi: "id" as XML attribute

juan.hernandez at redhat.com juan.hernandez at redhat.com
Mon Dec 14 15:05:27 UTC 2015


Juan Hernandez has submitted this change and it was merged.

Change subject: restapi: "id" as XML attribute
......................................................................


restapi: "id" as XML attribute

Currently some of the entities of the model explicity define an "id"
attribute instead of extending the "Identified" interface. For example,
the "LogicalUnit" entity defines its own "id" attribute. As a result the
generated XML complex type contains an inner "id" element:

  <xs:complexType name="LogicalUnit">
    <xs:sequence>
      <xs:element name="id" type="xs:string" .../>
      ...
    </xs:sequence>
  </xs:complexType>

But the "id" attribute should always be represented as an XML attribute,
as that is what was done in previous versions of the API, and it is a
common practice in other usages of XML.

To solve this problem this patch changes the XML schema generator so
that it will take into account that some model attributes need to be
represented as XML attributes instead of inner elements. The "id"
attribute is the only one that needs this special treatment at the
moment, but the pach implements a more generic approach, just in case.

The resulting representation, for example for "LogicalUnit", will be the
following:

  <xs:complexType name="LogicalUnit">
    <xs:sequence>
      ...
    </xs:sequence>
    <xs:attribute name="id" type="xs:string"/>
  </xs:complexType>

Change-Id: I046b8bd2f71e0add754e4193885aeb8ba7110e70
Signed-off-by: Juan Hernandez <juan.hernandez at redhat.com>
---
M backend/manager/modules/restapi/metamodel/tool/src/main/java/org/ovirt/api/metamodel/tool/SchemaGenerator.java
M backend/manager/modules/restapi/metamodel/tool/src/main/java/org/ovirt/api/metamodel/tool/SchemaNames.java
2 files changed, 48 insertions(+), 9 deletions(-)

Approvals:
  Martin Peřina: Verified; Looks good to me, but someone else must approve
  Juan Hernandez: Verified; Looks good to me, approved
  Jenkins CI: Passed CI tests



-- 
To view, visit https://gerrit.ovirt.org/50320
To unsubscribe, visit https://gerrit.ovirt.org/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I046b8bd2f71e0add754e4193885aeb8ba7110e70
Gerrit-PatchSet: 3
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Jenkins CI
Gerrit-Reviewer: Juan Hernandez <juan.hernandez at redhat.com>
Gerrit-Reviewer: Martin Peřina <mperina at redhat.com>
Gerrit-Reviewer: gerrit-hooks <automation at ovirt.org>



More information about the Engine-commits mailing list