Hi I am using swagger UI for documenting APIs in my node.js application. I successfully configured and it is working fine.
But I right now I am facing one serious problem.
here is my sample swagger code from my controller
exports.people = {
'spec':
{
path : "/people",
method: "POST",
summary : "Create new person",
notes : "Create new person",
nickname : "people",
parameters : [param.form("email", "email", "string", true),
param.form("firstName", "firstName", "string", true),
param.form("paylod", "Payload", "string", true),
param.form("lastName", "lastName", "string", true)]
},
'action': function(req, res)
{
-----code----
}
}
In this, I have payload
parameter which take value in json
format as
{"id": <your-ID>,"latd":<latitude- value>","long":<longitude- value>"}
but if I pass invalid json
like
id=abc latd=1234 long=asv
then server is crashing. I have to add validation for this parameter so how can I add validation on this particular parameter.