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 has been archived by the owner on Mar 26, 2021. It is now read-only.
For some requests it's useful to validate that a value was not returned, e.g. when creating a user and ensuring the response doesn't have the password.
Another possible workaround (and possibly a better approach for some circumstances) is to use jsonschema validation.
I haven't tried it, but a quick search makes it looks like it's possible to validate jsonschema using null and undefined.
It would be necessary to pass content instead of content.password to the jsonschema validation
additionalProperties: false errors if there are any additional properties, and doesn't specify which specifically, so there's some cognitive overhead in trying to determine which property in the response is responsible for the error.
but without any luck. It seems as through additionalProperties expects an array of types, anyhow.
With a quick evaluation of using [undefined] for the password property's type in schemaValidate it seems as though any values in the response are ignored, whether undefined or defined.
EDIT:
It would be necessary to pass content instead of content.password to the jsonschema validation
Still need to give this a bash
EDIT #2:
Already done this ^, as per my schemaValidate example :P
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
For some requests it's useful to validate that a value was not returned, e.g. when creating a user and ensuring the response doesn't have the password.
At the moment https://github.com/eykrehbein/strest/blob/master/src/test.ts#L426 prevents one from testing non-existence of properties.
Describe the solution you'd like
Adding
undefined
as a 'type' or value to validate against.Describe alternatives you've considered
Adding
null
to responses is a work-around, but isn't ideal.The text was updated successfully, but these errors were encountered: