Forcing elements order in XML example file
dcourtil opened this issue · 0 comments
dcourtil commented
Given the following RAM, along with files referenced by it
- api.raml:
#%RAML 1.0
title: Sample API
version: 1.0
description: Sample API
uses:
policy: libraries/policy.raml
/sample/call:
post:
description: Submit policy
body:
application/xml:
type: policy.Policy
description: Policy
example: !include examples/example-policy.xml
responses:
200:
body:
application/xml:
- libraries/policy.raml
#%RAML 1.0 Library
types:
Policy:
type: object
additionalProperties: false
properties:
companyCode:
description: Company Code
type: string
trackingId:
description: Tracking Id
type: string
required: false
userCode:
type: string
required: false
description: User ID
xml:
name: application
- examples/example-policy.xml
<?xml version="1.0" encoding="UTF-8"?>
<application>
<companyCode>CompanyCode</companyCode>
<userCode>abc1234</userCode>
<trackingId>5678</trackingId>
</application>
Getting below error after parsing API by command line:
- Error validating XML. Error: cvc-complex-type.2.4.d: Invalid content was found starting with element 'trackingId'. No child element is expected at this point. [line=16, col=18]
The error is thrown when XML elements are in different order than in properties of type. It seems that the order of the XML elements is being validated, when it should not.