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

Forcing elements order in XML example file  #686

@dcourtil

Description

@dcourtil

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions