You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 8, 2024. It is now read-only.
I'm not sure I understand the following behavior in the new parameter validation:
when'string'unlessisNaN(Number(String(param['example'])))
text="URI parameter '#{paramName}' is declared as 'string' but it is a number."
result['errors'].push text
In my opinion this should not be an error (or even a warning). If I have declared a parameter as a string in the blueprint, then I mean that it should be a string. Strings are allowed to have only numbers in them. Consider Hex values, for example, which in some cases would parse as a number ('1124'), and in other cases a string ('12FA') - so when I declare it in the blueprint as a string, I mean that it really is a string.
This is somewhat addressed in #106 and #107 but it seems to ignore the case above - if the example value was '12FA' then no error would be thrown - but '1124' is a perfectly valid example of a hex number, and shouldn't be flagged as an error.
The reverse of this makes sense (if I have declared a parameter as a number but it isn't parseable as one, then that's clearly a mistake).
A workaround for now is simply to ensure that any parameters declared as a string don't parse as a number (or pinning Dredd at 0.3.11).