Hi

I am new to Swagger, trying to model an existing XML based API with key 
value pairs as this one...

<attributeList>

    <attribute>

        <key>customerType</key>

        <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="xs:string">type1</value>

    </attribute>

    <attribute>

        <key>customerId</key>

        <value xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:type="xs:string">1234</value>

    </attribute>

<attributeList>


...in Swagger like this...
swagger: '2.0'
info:
  title: Case Mgmt APIs
  description: <removed>
host: <removed>
schemes:
  - http
basePath: /
securityDefinitions:
  basicAuth:
    type: basic
    description: HTTP Basic Authentication. Works over `HTTP` and `HTTPS`
paths:
  /crmCase:
    post:
      summary: Create a new case
      description: Create a new case
      operationId: createCase
      consumes: 
        - application/xml
      produces:
        - application/xml
      security:
        - basicAuth: []
      parameters:
        - name: request_body
          in: body
          required: true
          schema:
            $ref: "#/definitions/crmCase"
      tags:
        - crmCase
      responses:
        200:
          <removed>
        403:
          <removed>
definitions:
  customerType:
    type: object
    required:
      - key
      - value
    properties:
      key:
        type: string
        default: customerType
        enum: 
          - customerType
      value:
        type: string
        enum:
          - type1
          - type2
        xml:
          namespace: http://www.w3.org/2001/XMLSchema-instance
          prefix: xsi
    xml:
      name: attribute
  customerId:
    type: object
    required:
      - key
      - value
    properties:
      key:
        type: string
        default: customerId
        enum: 
          - customerId
      value:
        type: string
        pattern: '^[1][0-9]{3}$'
        xml:
          namespace: http://www.w3.org/2001/XMLSchema-instance
          prefix: xsi
    xml:
      name: attribute
  crmCase:
    type: object
    properties:
      attributeList:
        description: Customer deployment specific list of parameters
        type: array
        items:
          type: object
          properties:
            customerType:
              $ref: '#/definitions/customerType'
            customerId:
              $ref: '#/definitions/customerId'
          required:
            - customerType
        xml:
          name: attribute



... but no luck. Having searched on this subject a lot, I still have two 
issues:

I1) name: attribute is not taken/displayed in editor.swagger.io. Any idea 
why and whether this approach is correct for having multiple times the same 
attribute?

I2) key and value on customerId is considered mandatory by 
editor.swagger.io, although the customerId as such is supposed to be 
optional in this sample. Maybe I am dayblind... but I struggle to identify 
what I am doing wrongly. Whenever optional customer is added, key and value 
are mandatory. 


Many thanks for your help
René


-- 
You received this message because you are subscribed to the Google Groups 
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to