Skip to content

Conversation

TiFu
Copy link
Contributor

@TiFu TiFu commented Oct 10, 2025

First time contributing to RESTinstance - so in case I missed something, let me know! :)

This PR introduces a new feature to allow checks for values that can be null (e.g. to assert a values is either string or null).

This is implemented as a non-breaking change, i.e. current behavior of not accepting null is maintained.

Example usage:

String response body  nullable=True # Validate whether `response.body == null || response.body is "string"
Integer response body  nullable=True # Validate whether `response.body == null || response.body is "integer"
Array response body  nullable=True # Validate whether `response.body == null || response.body is "array"
Object response body  nullable=True # Validate whether `response.body == null || response.body is "object"
Number response body  nullable=True # Validate whether `response.body == null || response.body is "number"

  • Test cases for _set_type_validations have been added both base case and nullable
  • Documentation is updated to reflect this new option

…ions of type "X or null" (eg String or null)

Example: String response body username  nullable=True
@asyrjasalo asyrjasalo self-requested a review October 14, 2025 04:36
Copy link
Owner

@asyrjasalo asyrjasalo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great!

@asyrjasalo asyrjasalo merged commit 15d04e7 into asyrjasalo:master Oct 14, 2025
15 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants