Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

[BREAKING] Require Get 1.0.0 or greater#83

Merged
liamnichols merged 5 commits intomainCreateAPI/CreateAPI:mainfrom
ln/get-1.0.0CreateAPI/CreateAPI:ln/get-1.0.0Copy head branch name to clipboard
Aug 4, 2022
Merged

[BREAKING] Require Get 1.0.0 or greater#83
liamnichols merged 5 commits intomainCreateAPI/CreateAPI:mainfrom
ln/get-1.0.0CreateAPI/CreateAPI:ln/get-1.0.0Copy head branch name to clipboard

Conversation

@liamnichols
Copy link
Member

@liamnichols liamnichols commented Aug 3, 2022

Background

Get 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 Request initialiser directly.

By doing this, it greatly simplifies the requirements of the Request type meaning that Get is free to change other aspects of its interface and CreateAPI is free to offer a simple Request type 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) requestOperationIdExtension since the id parameter is available on the initialiser.

Implications

This change comes with two potentially breaking implications to be aware of:

  1. If you use Get, you'll need to migrate from 0.x.x to 1.x.x
  2. If you didn't use Get and had been providing your own Request type, 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

  • Generated packages and paths now depend on Get 1.0.2 or later. If you don't use Get, your Request type must expose an initializer that matches the initializer defined in Get. For more information, see #83.

@liamnichols liamnichols added this to the 0.1.0 milestone Aug 3, 2022
@liamnichols liamnichols self-assigned this Aug 3, 2022
@liamnichols liamnichols added the breaking Results in a breaking change in behaviour label Aug 3, 2022
@liamnichols liamnichols merged commit 55c701f into main Aug 4, 2022
@liamnichols liamnichols deleted the ln/get-1.0.0 branch August 4, 2022 10:28
@kean
Copy link
Member

kean commented Aug 17, 2022

I'm working on addressing the design issues with the Request that I raised earlier. Here's a draft MR that I would love to get your and @LePips feedback on.

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Results in a breaking change in behaviour

Projects

None yet

Development

Successfully merging this pull request may close these issues.

--package should use Get starting from version 1.0.0 requestOperationIdExtension adds private extension making it inaccessible if in a separate file

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.