swagger-editor icon indicating copy to clipboard operation
swagger-editor copied to clipboard

parse error for $ref in properties

Open andriy-polanski opened this issue 10 years ago • 2 comments

    parameters:
        - name: body
          in: body
          required: true
          schema:
            type: object
            properties:
              userId:
                type: string
                example: 5695b0b389f3409e2986eee9
              event:
                schema:
                  $ref: '#/definitions/AnalyticEvent'
              userDevice:
                schema:
                  $ref: '#/definitions/UserDevice'

Above config works fine, but I see parse error

SyntaxError: Error in Swagger definition 
    SyntaxError: Data does not match any schemas from "oneOf" 
    Data path: "/paths/~1mobile~1track_event/post/parameters/0" 
    Schema path: "/properties/paths/patternProperties/^~1/properties/post/properties/parameters/items/oneOf"

Is it expected?

andriy-polanski avatar Jan 13 '16 02:01 andriy-polanski

Yup. Try:

    parameters:
        - name: body
          in: body
          required: true
          schema:
            type: object
            properties:
              userId:
                type: string
                example: 5695b0b389f3409e2986eee9
              event:
                $ref: '#/definitions/AnalyticEvent'
              userDevice:
                $ref: '#/definitions/UserDevice'

webron avatar Jan 13 '16 02:01 webron

Thanks for quick response @webron ! Parse went well without error.

andriy-polanski avatar Jan 13 '16 02:01 andriy-polanski