[BREAKING] Require Get 1.0.0 or greater#83
Merged
liamnichols merged 5 commits intomainCreateAPI/CreateAPI:mainfrom Aug 4, 2022
Merged
[BREAKING] Require Get 1.0.0 or greater#83liamnichols merged 5 commits intomainCreateAPI/CreateAPI:mainfrom
liamnichols merged 5 commits intomainCreateAPI/CreateAPI:mainfrom
Conversation
…ead of telesopic methods
cdba960 to
bf5d179
Compare
This was referenced Aug 4, 2022
Closed
Member
|
I'm working on addressing the design issues with the I believe it won't affect the existing CreateAPI implementation too much. // Before
Request(method: "PATCH", url: path, body: body)
// After
Request(method: .patch, path: path, body: body)
Request(method: "PATCH", path: path, body: body) // ExpressibleByStringLiteral |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Background
--packageshould use Get starting from version 1.0.0 #80Get recently released a new major version 1.0.0 (and 1.0.1), meaning that current CreateAPI generated packages will not use anything beyond 0.8.0 as per the semantic versioning requirements defined in the generated Package.swift files.
To coincide with CreateAPI's 0.1.0 release, there are also some semi-breaking enhancements in this area that we can make to help fix some other related issues and minimise the dependence on implementation details of Get.
Changes
In this pull request, I not only bump the version defined in the generated Package.swift to 1.0.0, but I also update the Paths generator to stop using the telescoping methods in favour of using the
Requestinitialiser directly.By doing this, it greatly simplifies the requirements of the
Requesttype meaning that Get is free to change other aspects of its interface and CreateAPI is free to offer a simpleRequesttype when the user does not want to depend on Get directly.This results in diffs to the generated code like the following:
public func patch(_ body: edgecases_tabs.Client) -> Request<edgecases_tabs.Client> { - .patch(path, body: body) +. Request(method: "PATCH", url: path, body: body) }I was also able to cleanup the (sometimes faulty)
requestOperationIdExtensionsince theidparameter is available on the initialiser.Implications
This change comes with two potentially breaking implications to be aware of:
Requesttype, you might need to make sure that you expose the appropriate initialiser*As far as I am aware, there are no major breaking changes in Get. The release notes can be found here: https://github.com/kean/Get/releases/tag/1.0.0
Release Note
Requesttype must expose an initializer that matches the initializer defined in Get. For more information, see #83.