Skip to content

Commit 524b4b9

Browse files
authored
Merge pull request #1411 from Shopify/remove-api-version-constants
[Breaking] Remove API version constants
2 parents 8b20cf3 + 4b3cbf8 commit 524b4b9

File tree

5 files changed

+66
-17
lines changed

5 files changed

+66
-17
lines changed

BREAKING_CHANGES_FOR_V15.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,65 @@
11
# Breaking change notice for version 15.0.0
22

3+
## Removal of `LATEST_SUPPORTED_ADMIN_VERSION` and `RELEASE_CANDIDATE_ADMIN_VERSION` constants
4+
5+
The `LATEST_SUPPORTED_ADMIN_VERSION` and `RELEASE_CANDIDATE_ADMIN_VERSION` constants have been removed to prevent semantic versioning (semver) breaking changes. Previously, these constants would automatically update every quarter when new API versions were released, causing unintended breaking changes for apps.
6+
7+
### Migration Guide
8+
9+
**If you were using these constants directly:**
10+
11+
```ruby
12+
# Before (v14 and earlier)
13+
api_version = ShopifyAPI::LATEST_SUPPORTED_ADMIN_VERSION
14+
# or
15+
api_version = ShopifyAPI::RELEASE_CANDIDATE_ADMIN_VERSION
16+
17+
# After (v15+)
18+
api_version = "2025-07" # Explicitly specify the version you want to use
19+
```
20+
21+
**In your Context.setup:**
22+
23+
The `api_version` parameter has always been required in `Context.setup`, so most apps should not be affected. However, you must now explicitly specify which API version you want to use:
24+
25+
```ruby
26+
# Before (v14 and earlier)
27+
ShopifyAPI::Context.setup(
28+
api_key: "<api-key>",
29+
api_secret_key: "<api-secret-key>",
30+
host: "<https://application-host-name.com>",
31+
scope: "read_orders,read_products,etc",
32+
is_embedded: true,
33+
api_version: ShopifyAPI::LATEST_SUPPORTED_ADMIN_VERSION, # This constant no longer exists
34+
is_private: false,
35+
)
36+
37+
# After (v15+)
38+
ShopifyAPI::Context.setup(
39+
api_key: "<api-key>",
40+
api_secret_key: "<api-secret-key>",
41+
host: "<https://application-host-name.com>",
42+
scope: "read_orders,read_products,etc",
43+
is_embedded: true,
44+
api_version: "2025-07", # Explicitly specify the version
45+
is_private: false,
46+
)
47+
```
48+
49+
**Finding the right API version:**
50+
51+
You can see all supported API versions by referencing:
52+
```ruby
53+
ShopifyAPI::SUPPORTED_ADMIN_VERSIONS
54+
# => ["unstable", "2025-10", "2025-07", "2025-04", ...]
55+
```
56+
57+
**Why this change?**
58+
By requiring explicit version specification, apps can:
59+
- Control when they upgrade to new API versions
60+
- Test thoroughly before upgrading
61+
- Avoid unexpected breaking changes from automatic version updates
62+
363
## Removal of `ShopifyAPI::Webhooks::Handler`
464

565
The `ShopifyAPI::Webhooks::Handler` class has been removed in favor of `ShopifyAPI::Webhooks::WebhookHandler`. The `ShopifyAPI::Webhooks::WebhookHandler` class is now the recommended way to handle webhooks.

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
Note: For changes to the API, see https://shopify.dev/changelog?filter=api
44
## Unreleased
55

6+
- [#1411](https://github.com/Shopify/shopify-api-ruby/pull/1411) Remove `LATEST_SUPPORTED_ADMIN_VERSION` and `RELEASE_CANDIDATE_ADMIN_VERSION` constants to prevent semver violations. Developers must now explicitly specify API versions. See the [migration guide](BREAKING_CHANGES_FOR_V15.md#removal-of-latest_supported_admin_version-and-release_candidate_admin_version-constants) for details.
7+
68
- [#1405](https://github.com/Shopify/shopify-api-ruby/pull/1405) Fix webhook registration for topics containing dots (e.g., `customer.tags_added`, `customer.tags_removed`)
79

810
## 14.11.1

lib/shopify_api/admin_versions.rb

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,7 @@ module AdminVersions
2222
"2022-04",
2323
"2022-01",
2424
], T::Array[String])
25-
26-
LATEST_SUPPORTED_ADMIN_VERSION = T.let("2025-07", String)
27-
RELEASE_CANDIDATE_ADMIN_VERSION = T.let("2025-10", String)
2825
end
2926

3027
SUPPORTED_ADMIN_VERSIONS = ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS
31-
LATEST_SUPPORTED_ADMIN_VERSION = ShopifyAPI::AdminVersions::LATEST_SUPPORTED_ADMIN_VERSION
32-
RELEASE_CANDIDATE_ADMIN_VERSION = ShopifyAPI::AdminVersions::RELEASE_CANDIDATE_ADMIN_VERSION
3328
end

lib/shopify_api/context.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ class Context
77

88
@api_key = T.let("", String)
99
@api_secret_key = T.let("", String)
10-
@api_version = T.let(LATEST_SUPPORTED_ADMIN_VERSION, String)
10+
@api_version = T.let("", String)
1111
@api_host = T.let(nil, T.nilable(String))
1212
@scope = T.let(Auth::AuthScopes.new, Auth::AuthScopes)
1313
@is_private = T.let(false, T::Boolean)
@@ -101,8 +101,8 @@ def load_rest_resources(api_version:)
101101
@rest_resource_loader&.setup
102102
@rest_resource_loader&.unload
103103

104-
# No resources for the unstable version or the release candidate version
105-
return if api_version == "unstable" || api_version == RELEASE_CANDIDATE_ADMIN_VERSION
104+
# No resources for the unstable version
105+
return if api_version == "unstable"
106106

107107
version_folder_name = api_version.gsub("-", "_")
108108

@@ -155,7 +155,7 @@ def embedded?
155155

156156
sig { returns(T::Boolean) }
157157
def setup?
158-
[api_key, api_secret_key, T.must(host)].none?(&:empty?)
158+
[api_key, api_secret_key, api_version, T.must(host)].none?(&:empty?)
159159
end
160160

161161
sig { returns(T.nilable(Auth::Session)) }

test/admin_versions_test.rb

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,5 @@ class AdminVersionsTest < Minitest::Test
88
def test_supported_admin_versions
99
assert_instance_of(Array, ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS)
1010
end
11-
12-
def test_supported_latest_supported_admin_version
13-
assert_instance_of(String, ShopifyAPI::AdminVersions::LATEST_SUPPORTED_ADMIN_VERSION)
14-
end
15-
16-
def test_supported_release_candidate_admin_version
17-
assert_instance_of(String, ShopifyAPI::AdminVersions::RELEASE_CANDIDATE_ADMIN_VERSION)
18-
end
1911
end
2012
end

0 commit comments

Comments
 (0)