Skip to content

Conversation

@bmurphy23
Copy link

This PR address #15. If an Enumerable attribute (map or list-of-maps) is flagged as optional, and that attribute is not in the input, I'd expect the output from Speck.validate/2 to be as minimal as possible. For a top-level attribute, that means a nil value. For anything below the top level, that would mean being entirely omitted from the output. To make this happen, I've made the handling of optional values a higher priority in apply_filters.

One behavioural change not directly related to the above is that a non-optional Enumerable that is omitted will not recursively report :not_found errors. Instead, the map/list-of-maps will itself be marked as :not_found, and the interior elements skipped entirely. The old behaviour is easy enough to re-implement by moving a condition in apply_filters.

@bmurphy23
Copy link
Author

After more exhaustive testing, there's still some behaviour that seems not quite right afoot. I'm tinkering with the code more.

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.

1 participant