Thursday, March 16, 2017

where does default value show up in swagger node request?

Leave a Comment

I have the below route:

/myroute:     x-swagger-router-controller: myroute     post:         operationId: createSomething         parameters:             - name: payload               in: body               required: true               schema:                   type: object                   properties:                       somedefault:                           type: string                           default: teststring 

and in my createSomething function I try to console log the values:

console.log(req.swagger.params.payload.value) and I expect to see

{somedefault: 'teststring'}

But I see nothing for somedefault. Am I misunderstanding where the default parameters should show up in swagger-node?

1 Answers

Answers 1

According to this, default is ignored if required is true.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment