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.
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.
Per failing test:
Further, why do we need to do this change at all? Can we not just encode the data as we had done previously?
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.
We can, but the data has a different shape. Instead of getting an object with keys
( namespace, routes )
, we have keys( name, description, url, home, gmt_offset, timezone_string, namespaces, authentication, routes, permalink_structure )
. Note the pluralnamespaces
. Hence the sort-of-faking happening here. How do you suggest proceeding? We can indeed pass the entire data and handle it differently on the client.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.
As far as I can recall,
withAPIData
really only cares about theroutes
property, and if we assume the schema response'routes
includes all registered routes, all the better. Other keys can simply be ignored.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've tested this change both as-is and by reverting the encoding changes as per some discussion with @aduth . Works great!
I can submit a separate PR, but thought it might be easier for someone with commit access to make the change in this PR and put the encoding stuff back in. Cheers!Never mind. I really need this so I've created PR #3778. Thx.