I am trying to define a simple swagger definition for a rest api. I am getting error on all my parameter section.
I am getting following swagger definition error in the swagger editor, I am not getting any clue what i wrong. please advise.
Swagger definition:
paths:
'/customer/{customerId}/accountlist':
get:
responses:
'200':
description: ''
parameters:
- name: customerId
in: path
allowMultiple: false
required: true
type: string
x-auth-type: None
x-throttling-tier: Unlimited
produces:
- application/json
x-scope: InternalUse
swagger: '2.0'
info:
title: Sample
description: API for Sample
Swagger Error:
Swagger Error
Not a valid parameter definition
Jump to line 7
Details
Object
code: "ONE_OF_MISSING"
params: Array [0]
message: "Not a valid parameter definition"
path: Array [5]
0: "paths"
1: "/customer/{customerId}/accountlist"
2: "get"
3: "parameters"
4: "0"
schemaId: "http://swagger.io/v2/schema.json#"
inner: Array [2]
0: Object
code: "ONE_OF_MISSING"
params: Array [0]
message: "Data does not match any schemas from 'oneOf'"
path: Array [5]
0: "paths"
1: "/customer/{customerId}/accountlist"
2: "get"
3: "parameters"
4: "0"
inner: Array [2]
0: Object
code: "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0: "schema"
message: "Missing required property: schema"
path: Array [0]
1: Object
code: "ONE_OF_MISSING"
params: Array [0]
message: "Data does not match any schemas from 'oneOf'"
path: Array [0]
inner: Array [4]
1: Object
code: "OBJECT_MISSING_REQUIRED_PROPERTY"
params: Array [1]
0: "$ref"
message: "Missing required property: $ref"
path: Array [5]
0: "paths"
1: "/customer/{customerId}/accountlist"
2: "get"
3: "parameters"
4: "0"
level: 900
type: "Swagger Error"
description: "Not a valid parameter definition"
lineNumber: 7
I rewrote your OpenAPI spec. This version is valid:
swagger: '2.0'
info:
title: Sample
version: 1.0.0
description: API for Sample
paths:
'/customer/{customerId}/accountlist':
get:
responses:
'200':
description: ''
parameters:
- name: customerId
in: path
required: true
type: string
x-auth-type: None
x-throttling-tier: Unlimited
produces:
- application/json
x-scope: InternalUse
Some comments about your original version:
The indenting was bad. For example the get:
line needs to be indented from the preceding line. But perhaps that was just a copy & paste issue.
The info
object requires a version
property.
The customerId
parameter included an allowMultiple
property. I was seeing an error until I removed that.