I am trying to implement API testing in my project and i am using Dredd. Now some of my response parameters return 'null' value and that is okay according to logic. In my yml file, how do i specify that null can be a valid value apart from the normal expected value, say, string.
cdeOutageUpdateType: {type: string}, txtDesc: {type: string},
In the above parameter, it is okay if cdeOutageUpdateType is empty. But my Dredd test fails because of it.
body: At '/19/cdeOutageType' Invalid type: null (expected string)
I found out the solution for this situation. Swagger specification can be modified with an attribute "x-nullable"
cdeOutageUpdateType: {type: string, x-nullable: true}, txtDesc: {type: string},
The above will ignore cdeOutageUpdateType if it is null.