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

How to handle creating multiple resources, but one of them has a validation error. #211

Open
eddieajau opened this issue Feb 15, 2017 · 0 comments

Comments

@eddieajau
Copy link

eddieajau commented Feb 15, 2017

Let's say I've set up a route to add articles.

model.call(
  ['articles', 'add'],                  // callPath
  [{ title: 'good' }, { title: 'bad' }] // arguments
).then(...)

The arguments are an array of articles to add. Normally I'd return a value like this to the router.

[
  {
    "path": [
      "articlesById",
      1,
      "id"
    ],
    "value": 1
  },
 {
    "path": [
      "articlesById",
      2,
      "id"
    ],
    "value": 2
  }
]

However, let's say an article with title of bad fails a validation check. What kind of path should I return to the router to show that the second article (which obviously can't have an id) has a validation error?

Or, do I need to restrict Falcor to only add one article at a time, then I can quite happily throw an Error?

Thanks in advance.

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

No branches or pull requests

1 participant