#627 refactor: refactor validation errors rendering
Pull request opened by
bethesque
This refactor changes the validation contracts from returning a Hash to returning the Dry:
Validation:Result.
The reason this is necessary is it makes it easier to render the validation errors as problem+json.
The old way went Dry:
Validation:MessageSet => hacky smush into custom format Hash => hacky smush into problem+json format. This can result in information loss in relation to the path of the errors. Also, the custom format Hash
only supports 1 array in the path, and we need 2 levels of arrays for the new provider contracts all-in-one endpoint.
The new approach is to return the Dry:
Validation:Result from the validation contracts, and then format the Dry:
Validation:MessageSet using a decorator in the resource (like we do for normal domain object resources). This means we have a lossless translation from error messages into problem+json, and don't need to have custom code for the new provider contract endpoint.
pact-foundation/pact_broker
GitHub Actions: rubocop
GitHub Actions: sqlite (3.2)
GitHub Actions: sqlite (2.7)
GitHub Actions: pact-verify
GitHub Actions: mysql
GitHub Actions: bundle-audit
GitHub Actions: postgres (9.6)
GitHub Actions: postgres (14)
GitHub Actions: postgres (15)
GitHub Actions: pact-verify
GitHub Actions: bundle-audit
GitHub Actions: postgres (9.6)
GitHub Actions: postgres (14)
GitHub Actions: postgres (15)
GitHub Actions: mysql
GitHub Actions: sqlite (3.2)
GitHub Actions: sqlite (2.7)
GitHub Actions: rubocop
✅ 1 other check has passed
1/19 successful checks