Support for XML Data and XML Schema Added to Our RAML Parsers

Release DateMar 5, 2019
Change Type
Platforms Affected

    Both versions of RAML (0.8, 1.0) support XML examples and XML schema definitions. Previously, we supported only JSON examples and JSON schema definitions found in RAML input files. Now, however, we support parsing of XML examples and XML schema definitions as well.

    Details

    XML examples and XML schema type specifications are allowed at several levels in RAML e.g. request/response body definitions, global schema/type definitions, etc. While these were ignored previously by our tool, we now utilize them in case no JSON examples/schema definitions are found.

    Example

    /jobs:
      displayName: Jobs
      post:
        description: Create a Job
        body:
          text/xml:
            schema: |
              <xs:schema attributeFormDefault="unqualified"
                         elementFormDefault="qualified"
                         xmlns:xs="http://www.w3.org/2001/XMLSchema">
                <xs:element name="api-request">
                  <xs:complexType>
                    <xs:sequence>
                      <xs:element type="xs:string" name="input"/>
                    </xs:sequence>
                  </xs:complexType>
                </xs:element>
              </xs:schema>
            example: |
              <api-request>
                <input>Test Input</input>
              </api-request>
    

    For the above case, in order to extract information about the request body, our parsers will internally convert the XML schema to a JSON schema and the XML example to a JSON example.

    Note   Since information extracted from XML schema/XML examples is essentially mapped to a JSON structure, it may not support every XML feature.

    Related Links


    Have questions? Submit a request.