dredd icon indicating copy to clipboard operation
dredd copied to clipboard

An error occurs if "example value" is false and "required"

Open motoyasu-saburi opened this issue 8 years ago • 1 comments

for more information https://github.com/apiaryio/dredd/issues/677#issuecomment-265946791

I think that we should change this conditional statement as follows.

https://github.com/apiaryio/dredd-transactions/blob/5b7f09f1777797451098864257175869e5f6b43e/src/validate-parameters.coffee#L6 before

if param.required and not param.example and not param.default

after

if param.required and not param.example and not param.default and typeof param.example isnt 'boolean'

https://github.com/apiaryio/dredd-transactions/blob/5b7f09f1777797451098864257175869e5f6b43e/src/expand-uri-template-with-parameters.coffee#L44 before

if param.example

after

if param.example or typeof param.example is 'boolean'

Are there better ideas? If there is no problem I will write a test and send a pull request.

motoyasu-saburi avatar Feb 12 '17 05:02 motoyasu-saburi

Thanks! I think this problem has the same root as what we're discussing in https://github.com/apiaryio/dredd/issues/677#issuecomment-280013517.

honzajavorek avatar Feb 15 '17 13:02 honzajavorek