Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Forcing elements order in XML example file #686

Open
dcourtil opened this issue Mar 18, 2020 · 0 comments
Open

Forcing elements order in XML example file #686

dcourtil opened this issue Mar 18, 2020 · 0 comments

Comments

@dcourtil
Copy link

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant