-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
JSON API Errors Object #3893
Comments
hey @igorT would you happen to know how we can approach this? |
@sescobb27 This is a hunch, but did you put an 'errors' property on your model? By default it is an instance of DS.Errors which has an add method. If you've accidentally replaced this with your own errors property, the |
Yes this looks definitely as |
@DrSpaniel, we are using
|
@tchak Is there a way we can raise a warning if a user defines an errors attribute on a model? |
@sescobb27 EmberValidations isn't meant to be mixed in with the model. Mix it into your controller or your component instead |
@DrSpaniel 😞 so, do I need to copy/paste those validations in every controller where I need them? BTW thanks for yor help guys :) |
@sescobb27 You can create a mixin with just that validations hash, then mix that into your controllers.
I work at dockyard btw, and we're talking right now about how we can make this clearer in the documentation |
@DrSpaniel we can definitely add a warning if someone overrides |
I'd love a commit in ED, let me do the PR?
|
I am not sure about the general case... And in your list there is a lot of static attributes/methods. I would not care much about them. |
@DrSpaniel you are saying that How then we can validate complex graphs? /cc @bcardarella |
@oleg-andreyev that's true, the post does leave an open ended question. I'm not sure we ever resolved it. The ember-validations repo would probably be a better place for that discussion though. |
@bcardarella why not? It causes ED to crash if you do override it |
@bcardarella in this case we're not overriding with an API compliant object though. We could check for API compliance and only warn if it doesn't match? My worry is that domain 'errors' properties are probably not uncommon, and we should guard against accidental overrides. |
@bcardarella @DrSpaniel what about overriding |
@bcardarella I think there's a case to be made for protecting the average developer from naively adding an |
@bcardarella @DrSpaniel The thing is I didn't override the |
Super minor correction here: my suggestion was to extract a shared object (not in ember-data's repo) that can be used by both projects. I am not 100% certain that the current |
Ya, makes sense |
Good news is, we are moving away from complex event mechanics in |
own API it's Ember way guys! More own api, and soon you will 0 users. |
closing as we have no intent on changing the API of |
Hi, we are migrating to Ember 1.13 and Ember Data 1.13 but we are having issues with JSON API error objects in tests:
the exception is thrown in
internal-model.js
when doingget(record, 'errors').add(attribute, message);
in which record is equal tocustomerSupport
model,attribute
is equal toemail
and message is equal to'Error Sending Email, Please try again!!!'
what are we doing wrong? thanks
The text was updated successfully, but these errors were encountered: