Swagger says"not a valid parameter defenition" -


i'm new swagger , appreciate direction on resources learning.

i have test project i'm putting , running issues.

i'm getting error saying "parameters" in "delete" block not valid. looks ok me i've seen in examples. apparently i'm missing something. ideas?

swagger: "2.0"  info:   version: "2"   title: title   description: provides services vacation rentals site   termsofservice: private   contact:     name: name     url: www.myurl.com     email: my@email.address   license:     name: mit     url: http://opensource.org/licenses/mit schemes:   - http host: myurl.com basepath: /api  paths:    /guestbook:     get:       summary: gets persons       description: returns list containing persons.       responses:         200:           description: list of posts           schema:             type: array             items:               required:                 - firstname               properties:                 firstname:                   type: string                 lastname:                   type: string                 email:                   type: string                 comment:                   type: string     post:       summary: adds comment guestbook       description: adds comment guestbook       parameters:         - name: firstname           in: formdata           required: true           type: string         - name: lastname           in: formdata           required: true           type: string         - name: email           in: formdata           required: true           type: string         - name: comment           in: formdata           required: true           type: string        responses:         201:           description: shows successful post         '405':           description: invalid input   /guestbook/{id}:     get:       summary: gets single post       description: returns single post       operationid: getpost       parameters:         - name: id           in: path           description: id of pet fetch           required: true           type: integer           format: int64       responses:         200:           description: list of posts           schema:             type: array             items:               required:                 - firstname               properties:                 id:                   type: number                 firstname:                   type: string                 lastname:                   type: string                 email:                   type: string                 comment:                   type: string     delete:       summary: removes post       description: removes post       operationid: deletepost       parameters:         - name: id           in: path       responses:         200:           description: post has been removed 

you need describe id parameter in delete /guestbook/{id} operation did in get /guestbook/{id}.

delete:   summary: removes post   description: removes post   operationid: deletepost   parameters:     - name: id       in: path       description: id of pet fetch       required: true       type: integer       format: int64   responses:     200:       description: post has been removed 

you can define parameter once operations of path /guestbook/{id}:

/guestbook/{id}:   parameters:     - name: id       in: path       description: id of pet fetch       required: true       type: integer       format: int64   get:     summary: gets single post     description: returns single post     operationid: getpost     responses:       200:         description: list of posts         schema:           type: array           items:             required:               - firstname             properties:               id:                 type: number               firstname:                 type: string               lastname:                 type: string               email:                 type: string               comment:                 type: string   delete:     summary: removes post     description: removes post     operationid: deletepost     responses:       200:         description: post has been removed 

if need learn how write openapi (fka. swagger) specification files, can read writing openapi/swagger specification tutorial


Comments

Popular posts from this blog

jOOQ update returning clause with Oracle -

java - Warning equals/hashCode on @Data annotation lombok with inheritance -

java - BasicPathUsageException: Cannot join to attribute of basic type -