-
Notifications
You must be signed in to change notification settings - Fork 16
Modified locale handling to inspect request parameters #80
Conversation
If I'm correct the API for external users of the library didn't change, so we could live with an update only of the minor version number? 1.9? |
| /// | ||
| /// - Returns: The path with the locale appended, or the original path if it already had a locale param. | ||
| /// | ||
| @objc class public func pathByAppendingPreferredLanguageLocale(_ path: String) -> String { |
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.
Do we no longer need to use this method on ObjC in the main app?
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 searched for consumers of this in the try/wordpresskit-72-validation branch I created, and could not find any.
frosty
left a comment
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.
Thanks for tackling this!
I built and ran tests in all the projects you specified, and all passed ✅
I left a couple of code level comments, but nothing major. Also, I'm not sure if I missed something, but do these changes provide a way for a different localeKey to be provided to WordPressComRestApi? How will v2 endpoints specify the different key? Do they just specify it as part of their parameters? If so, how does applyLocaleIfNeeded know not to add locale in addition to _locale? I'm not hugely familiar with the code so I might just not understand how it fits together.
|
@frosty thanks for the review, and for your comments. I have pushed two commits that address the items you pointed out. Regarding:
Not just yet. The majority of that work is slated for #78, but the change to For that change, we will likely amend the signatures of these methods to inject the applicable locale key.
|
|
While tests pass locally, I should note that CircleCI is currently reporting a build error. I inquired about that Friday when others were observed, and was advised that the CircleCI transition is in progress for this repo, and CircleCI doesn’t have a config file for it just yet. |
|
Hey @SergioEstevao - I really appreciate you taking the time to review this!
This is something I considered as well. My reasoning for updating the major version was two-fold:
|
frosty
left a comment
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.
Thanks for your responses – that all makes sense :)
Fixes look good, too! Let's merge even though CircleCI is currently not working, as it builds / tests pass locally.
SergioEstevao
left a comment
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.
Great work! Please ping me on the follow-up PRs!
Description
Fixes #72, which observed that the existing framework behavior inspected a request's path for locale, and by default, appended it if missing. This change ensures that request parameters are also inspected for the presence of the parameter.
From the standpoint of semantic versioning, I view this as a breaking change.
Testing Details
Checkout the branch and confirm that existing tests pass.
Review the code and documentation for additional context.
From
WordPressAuthenticator, checkout the branchtry/wordpresskit-72-validationand confirm that it compiles & tests pass.From
WPiOS, checkout the branchtry/wordpresskit-72-validationand confirm that it compiles & tests pass. Also launch the app and exercise requests to confirm that there are no regressions.Please check here if your pull request includes additional test coverage.