I keep getting a failed schema validation error on a successful response
using swagger. However, I'm pretty sure my syntax is correct. Any ideas on
what is going wrong here?
My controller
function putAReview(req, res){
fakeDB.addReview(req.body.reviewObject.id,
req.body.reviewObject.reviewInteger)
.then( res => {
res.json({result: {result: res}}); //Outputs : { result: { result:
'success' } }
})
.catch( err =>{
res.status(500).json({error: {error: err}});
});
}
My route (YAML)
/review:
x-swagger-router-controller: wine
put:
operationId: putAReview
description: Review a wine based on ID
parameters:
- name: reviewObject
description: The ID and review integer of the wine to review
in: body
required: true
schema:
$ref: "#/definitions/ReviewWineByID"
# define the type of response for Success "200" and Error
responses:
"200":
description: Success
schema:
$ref: "#/definitions/ReviewWineByIDResponse"
default:
description: Error
schema:
$ref: "#/definitions/ReviewWineByIDErrorResponse"
My schema
ReviewWineByIDResponse:
required:
- result
properties:
result:
type: object
properties:
result:
type: string
--
You received this message because you are subscribed to the Google Groups
"Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.