Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Use coercion to encode query-string values in match->path #716
Use coercion to encode query-string values in match->path #716
Changes from 15 commits
25dd0ab
1819fa5
5829e1c
dba8d15
5f10465
21e5840
1ba77a7
f60a7ad
1b37c87
7ae2bfa
ce6d9e2
7ae118f
7e9116f
dfc5a4e
4eb29d3
5ca2219
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think "By default, collections ..." would read a bit better
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello! We've been testing these changes and we have a problem when using custom transformers. We think the problem might be this line. This line is ignoring the
transfomers
(there is a typo too) parameter and hard-codingstring-transfomer-provider
instead of using thetransformers
defined in the Reitit router configuration. Maybe it should be something like this?:Is there any reason for hard-coding
string-transformer-provider
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason is that
create
fn processestransformers
map and applies the options to TransformerProviders, then the transformer we see after that step is one withmt/strip-extra-keys-transformer
combined with the string-transformer.m/encoder
takes options map,:strip-extra-keys
isn't one of the options that would be used there (AFAIK). This option is only used for reitit.malli.coercion TransformationProviders: https://github.com/metosin/reitit/blob/master/modules/reitit-malli/src/reitit/coercion/malli.cljc#L27-L33I'll see what I can do.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see, you're right. The encoder doesn't take the
:strip-extra-keys
option.Maybe one solution could be to have a specific query string transformer provider that doesn't include the
:strip-extra-keys
transformer and include it by default in the Reitit router configuration.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@lucassousaf Check the latest commit, :string transformer will be used now. I did consider adding a new transfomers option for query-string encoding, but I think decoding and encoding should use the same transformer so using :string does seem good idea now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good! At first glance it seems to work as expected. If we find anything (I don't think so, looks good) we can open an issue. Thanks a lot for your work @Deraen !