Closed seriousdev-gh closed 3 weeks ago
Current Behavior: Error messages contain indices of elements from the previous request.
Expected Behavior: Error messages should be idempotent; for two identical requests, I expect the same error message.
Parameters:
params do requires :items, type: Array do requires :item, type: Hash do requires :name, type: String end end end
Sequence of Requests:
Request 1: {} Response: 'items is missing, items[item][name] is missing'
{}
Request 2: {"items":[{"item":{"name":"foo"}},{"item":{"name":"foo"}},{}]} Response: 'items[2][item] is missing, items[2][item][name] is missing'
{"items":[{"item":{"name":"foo"}},{"item":{"name":"foo"}},{}]}
Request 3: {} Response: 'items is missing, items[2][item][name] is missing'
The response to the last request should be the same as the response to the first request.
This issue is reproducible in version 1.7.1 and in the main branch.
I could reproduce in within 1.5.3. That's an old one. Thank you for pointing out and the specs
@seriousdev-gh found a way to fix it
Current Behavior: Error messages contain indices of elements from the previous request.
Expected Behavior: Error messages should be idempotent; for two identical requests, I expect the same error message.
Parameters:
Sequence of Requests:
Request 1:
{}
Response: 'items is missing, items[item][name] is missing'Request 2:
{"items":[{"item":{"name":"foo"}},{"item":{"name":"foo"}},{}]}
Response: 'items[2][item] is missing, items[2][item][name] is missing'Request 3:
{}
Response: 'items is missing, items[2][item][name] is missing'The response to the last request should be the same as the response to the first request.
This issue is reproducible in version 1.7.1 and in the main branch.