swagger-editor
swagger-editor copied to clipboard
parse error for $ref in properties
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?
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'
Thanks for quick response @webron ! Parse went well without error.