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
Uncertainities around constraints #1578
Comments
The reverse stuff is mostly there for HATEOAS stuff which I've not finished experimenting with (ran into other missing stuff and implemented them such as uri templates). It's a slow process. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issues
forward
mode appears to have ever been used throughout cowboy. The support forreverse
andformat_error
seems to be lackingDiscussion
forward
,reverse
andformat_error
modes is a cool idea. But it seems it was never decided, how thereverse
andformat_error
modes should be usedvalidate/2
andreverse/2
should be identical so the user would not need to worry which of the two modes is used. But if the constrains do subsequent transformations (eg. first parses a datetime and second transforms the datetime to age) thereverse/2
has to be called with reverted list of constraintsformat_error
mode, you need to catch an exception from match function (cowboy_req:match_qs/2
,cowboy_req:match_cookies/2
orcowboy_req:read_and_match_urlencoded_body/2
) and extract the constraint and its arguments from an undocumented structurekey=1&key=2
query would result in#{key := [1, 2]}
which would implyint
constraint was used on single values. It also seems natural to me to use the constraints on every value separately and only combine them to the list after. Nevertheless the implementation passes a list of binaries of all the values to the constraints. So separate constraints have to be created for keys allowing for multiple valuesint/2
andnonempty/2
as exports which are actually internals, while the actual exportsvalidate/2
,reverse/2
andformat_error/1
are not mentionedThe text was updated successfully, but these errors were encountered: