data icon indicating copy to clipboard operation
data copied to clipboard

Finder should not inspect adapter's payload too closely

Open Elberet opened this issue 8 years ago • 1 comments

I've run into a slight problem with Ember data.

My use case:

  • For business reasons, my backend needs to talk XML. Luckily, I get to define the XML response myself, so I'm working with somewhat sane documents.
  • I've written an Ember data serializer that consumes parsed XML documents (instances of XMLDocument) and emits proper JSONAPI compliant JavaScript objects for the Ember data store.

The problem:

Obviously, this is easy to circumvent: I've avoided the overzealous assertion by wrapping the XML document in an array and unwrapping it in my deserializer. But still, I would argue that it is not the _find method's job to check the adapter's result. This should be left entirely to the serializer. At most, it could check if the adapter's result is of type undefined or equal null, but for any other value, it should be assumed that a sufficiently clever serializer will be able to interpret the value in a meaningful way or throw a sensible error message.

Elberet avatar Feb 23 '17 17:02 Elberet

Broadly speaking I agree and have always found this frustrating.

runspired avatar Apr 22 '18 06:04 runspired

This is handled by https://github.com/emberjs/rfcs/pull/860, closing in favor

runspired avatar Nov 17 '22 01:11 runspired