-
-
Notifications
You must be signed in to change notification settings - Fork 748
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
feat: custom query key formatters #1570
feat: custom query key formatters #1570
Conversation
- Implements a key formatter for `camelCase`
…rs' into feat/custom-query-key-formatters
Can this be looked into, or is the PR stale? |
I guess they're too busy |
I was looking at this at the weekend, but I was away in Scotland, I working my way through the PR's to get them all dealt with appropriately. I will try to find time this weekend to go through this |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1570 +/- ##
==========================================
- Coverage 87.73% 86.19% -1.54%
==========================================
Files 33 34 +1
Lines 2348 2072 -276
Branches 294 297 +3
==========================================
- Hits 2060 1786 -274
+ Misses 208 206 -2
Partials 80 80 ☔ View full report in Codecov by Sentry. |
@tcortega Please could you recheck the code you have added after the merge to be sure it still covers the same intended update |
I'll check it either later tonight or tomorrow |
@ChrisPulman From my end, based on my changes, this is pretty much what I can do testing-wise. |
It looks like your unintentionally reverted #1619 when merging to the main branch, do you want me to fix this? |
@TimothyMakkison yes please |
@TimothyMakkison Trying to check everything as best as possible after the merges and updates to ensure all is still intact ready for a release, thank you for spotting this. |
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
What kind of change does this PR introduce?
Feature and docs update.
What is the current behavior?
Query keys in the URL are formatted based on property names without any customization.
What is the new behavior?
Introduces the capability for users to define custom formatting strategies for query keys in the URL. This can be achieved by implementing the
IUrlParameterKeyFormatter
interface and setting it inRefitSettings
. The default behavior remains unchanged (using property names as they are) to ensure backward compatibility. Also, the documentation has been updated to reflect these changes and guide users on how to utilize this feature.What might this PR break?
Care has been taken to ensure retro-compatibility. This PR should not introduce any breaking changes, as the default behavior remains consistent with previous versions.
Please check if the PR fulfills these requirements
Other information:
AliasAs
attribute always takes precedence in key naming, regardless of any custom key formatters in use.IUrlParameterFormatter
when dealing with dictionaries.AliasAs
attribute aligns with intuitive expectations and mirrors behaviors such asJsonPropertyName
in System.Text.Json.