Struggling with a YAML syntax error

40 views
Skip to first unread message

Jay Janarthanan

unread,
Oct 8, 2015, 10:45:07 AM10/8/15
to Swagger
My YAML

paths:
  /Ok:
    post:
      description: Simple OK Statment
      operationId: SalesForceOK
      parameters:
        - name: a
          in: query
          description: 'Security Key'
          required: true
          type: string
          default: 'RTczNTFERjMtRUIxOC00QTlBLUJGQzEtQTcyMzEwMTY4MDREOg=='
        - name: Message
          in: post
          type: string
          default: 'Test'
        - name: ClientId
          in: post
          type: integer
          default: 123
        - name: CreatedDateTime
          in: post
          type: string
          default: '01\01\2015'
      responses:
        "200":
          description: OK Response   
          parameters:
            - name: ErrorCode
              type: integer
              format: int32
            - name: ErrorMessage
              type: string
            - name: ClientId
              type: integer
              format: int32

For some reason the http://editor.swagger.io does not like the line where we have 200

 responses:
        "200":
          description: OK Response   

I am getting

Swagger Error

Data does not match any schemas from 'oneOf' on the line where I have "200" 



Jay








tony tam

unread,
Oct 8, 2015, 11:41:10 AM10/8/15
to Swagger
Hi, the response payload needs to be in a `schema` object:


Furthermore the payload description needs to be updated:

paths:
  /Ok:
    post:
      description: Simple OK Statment
      operationId: SalesForceOK
      parameters:
        - name: a
          in: query
          description: 'Security Key'
          required: true
          type: string
          default: 'RTczNTFERjMtRUIxOC00QTlBLUJGQzEtQTcyMzEwMTY4MDREOg=='
        - name: Message
          in: query
          type: string
          default: 'Test'
        - name: ClientId
          in: query
          type: integer
          default: 123
        - name: CreatedDateTime
          in: query
          type: string
          default: '01\01\2015'
      responses:
        "200":
          description: OK Response   
          schema:
            type: object
            properties:
              ErrorCode:
                type: integer
                format: int32
              ErrorMessage:
                type: string
              ClientId:
                type: integer
                format: int32

And finally type `post` in the parameters is not valid.  Assuming you mean `query`.  If you want a post body you would use `formData` as well as the `post:` method.

Jay Janarthanan

unread,
Oct 8, 2015, 12:55:27 PM10/8/15
to swagger-sw...@googlegroups.com
Tony, Thanks for this. Got the issue Fixed

Jay



photo
Jay Janarthanan

--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/W-ud5iGpmrI/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages