Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft of indexed errors implementation #467

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

fernandes
Copy link
Member

Hello,

Sorry if it's implemented elsewhere, I tried to find but didn't find, that's why I wrote a test case / drafted implementation so we can discuss.

Problem:
When have an API, errors for collections are not indexed, so not sure about what element caused the error. Rails has implemented this behavior on rails/rails#19686

Trying to set this configuration on my app, I wasn't successful, so implemented on Reform

Solution:

  1. Add one test for exactly the indexed errors, making the default, the non indexed behavior
  2. On Reform::Contract::Result::Errors if not using indexed errors, keep the usual behavior, else collect all the messages, but organized indexing for collections on the errors hash

TODO: @apotonick I know this class variable for configuration is stupid hahaha just wanted a fast
switch
for the test case, would it good how? as a feature?

TODO: do not use class variable for configuration
@fernandes
Copy link
Member Author

oh, now I double checked with rails implementation, it's supposed to be

:"variants[0].display_name" the id in the keys name, not an array, I'm gonna fix this

@emaglio
Copy link
Member

emaglio commented Jul 12, 2019

@fran-worley @apotonick should we consider these changes for the next release - if yes, let’s add it in the 2.3v milestone

@emaglio emaglio changed the base branch from master to v2.3.0.rc2 August 19, 2019 07:14
@emaglio emaglio changed the base branch from v2.3.0.rc2 to master August 19, 2019 07:14
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