I’m proposing some clean up to liberator’s decision tree. Happy to see comments on this: https://github.com/clojure-liberator/liberator/pull/229
I found this discussion here: https://groups.google.com/forum/#!topic/clojure-liberator/P3Vc9sW1h7Q I had a similar request ("Assuming data is well formed and content negotiation finished ok, I would like to check if posted data makes sense in my application context."), but I'm not satisfied in doing it in "malformed?". It feels like there should be another node somewhere around "exists?", maybe "valid?" plus a ":handle-valid", where you can check the actual posted data and return a 400 with a description which business rules were violated. What do you think?
For that use case there is processable-entity?
which returns 422 on false.
It’s not in the HTTP standard but from WEBDAV but’s it’s well known
400
should be returned if the request is syntactically invalid. e.g. a broken JSON document
422
is when the server understands the request but wants to refuse the request entity („body“).
i.e. syntactic vs. semantic validity
True, that makes sense. Thanks for the quick reply :simple_smile:
Great, tell me when you need help.
@ordnungswidrig: thanks for helping us out quickly :simple_smile:
you’re welcome :simple_smile:
@ordnungswidrig: new graph looks a lot less complicated... what is meant by the grey nodes though? Is the idea that the user can't override those ones anymore?
Yeah, thanks a lot - and no help needed, it was super easy to add the handler to :processable?, even although I'm using liberator through sweet-liberty :simple_smile:
@rickmoynihan: you can override those, but it does not make sense except for „side-effects“. They test the request method for a particular verb and there now way to the outcome could be different.
a legend would be useful
but yes that makes sense
Oh, a legend is a good idea. I’m afraid this will confuse the graphviz layout algorithm once again :simple_smile:
@rickmoynihan: do you mind raising an issue for it?
well I guess the legend could be in the accompanying text not in the graph-viz svg