|
| 1 | +# Migrating from v3 to v4 |
| 2 | + |
| 3 | +`v4` is a compatible evolution of `v3`. The Authentication API is unchanged, and the Management API keeps the same client structure, builder patterns, and pagination introduced in `v3`. The breaking changes are narrow: a few generated Management API types where field types were tightened or split for type-safety, and the removal of the Federated Connections Tokensets API. |
| 4 | + |
| 5 | +- [Overview](#overview) |
| 6 | +- [Breaking changes](#breaking-changes) |
| 7 | + - [1. Role pagination fields are now non-optional primitives](#1-role-pagination-fields-are-now-non-optional-primitives) |
| 8 | + - [2. Connection attribute `identifier` is split by attribute type](#2-connection-attribute-identifier-is-split-by-attribute-type) |
| 9 | + - [3. Phone provider protection backoff strategy enum value changed](#3-phone-provider-protection-backoff-strategy-enum-value-changed) |
| 10 | + - [4. Federated Connections Tokensets API removed](#4-federated-connections-tokensets-api-removed) |
| 11 | +- [Other changes](#other-changes) |
| 12 | + - [Per-request retry configuration](#per-request-retry-configuration) |
| 13 | + - [Query parameter serialization](#query-parameter-serialization) |
| 14 | +- [Migration steps](#migration-steps) |
| 15 | + |
| 16 | +## Overview |
| 17 | + |
| 18 | +Most `v3` code compiles and runs unchanged on `v4`. You only need to act if your code touches one of the following: |
| 19 | + |
| 20 | +| Area | What changed | Impact | |
| 21 | +|------|--------------|--------| |
| 22 | +| `ListRolesOffsetPaginatedResponseContent` | `start` / `limit` / `total` changed from `Optional<Double>` to primitive `double`, and are now required builder stages | Callers reading these getters or constructing the type | |
| 23 | +| Connection attributes | The shared `ConnectionAttributeIdentifier` type is removed and replaced by dedicated `EmailAttributeIdentifier`, `PhoneAttributeIdentifier`, and `UsernameAttributeIdentifier` types | Callers reading/setting `identifier` on `EmailAttribute`, `PhoneAttribute`, `UsernameAttribute` | |
| 24 | +| `PhoneProviderProtectionBackoffStrategyEnum` | `NONE` (`"none"`) removed, replaced by `DEFAULT` (`"default"`) | Callers referencing the `NONE` constant or visitor | |
| 25 | +| Federated Connections Tokensets | `client.users().federatedConnectionsTokensets()` and its types removed | Callers of that API | |
| 26 | + |
| 27 | +Everything else in `v4` is additive or internal. |
| 28 | + |
| 29 | +## Breaking changes |
| 30 | + |
| 31 | +### 1. Role pagination fields are now non-optional primitives |
| 32 | + |
| 33 | +In `ListRolesOffsetPaginatedResponseContent`, the `start`, `limit`, and `total` fields change from `Optional<Double>` to primitive `double`, and the builder now requires them as mandatory, staged arguments. |
| 34 | + |
| 35 | +**v3:** |
| 36 | +```java |
| 37 | +private final Optional<Double> start; |
| 38 | +public Optional<Double> getStart() { ... } |
| 39 | +``` |
| 40 | + |
| 41 | +**v4:** |
| 42 | +```java |
| 43 | +private final double start; |
| 44 | +public double getStart() { ... } |
| 45 | +``` |
| 46 | + |
| 47 | +If you read these getters, drop the `Optional` handling: |
| 48 | + |
| 49 | +```java |
| 50 | +// v3 |
| 51 | +double start = response.getStart().orElse(0d); |
| 52 | + |
| 53 | +// v4 |
| 54 | +double start = response.getStart(); |
| 55 | +``` |
| 56 | + |
| 57 | +If you construct the type, the builder is now staged and requires `start`, `limit`, and `total` in order: |
| 58 | + |
| 59 | +```java |
| 60 | +// v4 |
| 61 | +ListRolesOffsetPaginatedResponseContent content = ListRolesOffsetPaginatedResponseContent.builder() |
| 62 | + .start(0) |
| 63 | + .limit(50) |
| 64 | + .total(200) |
| 65 | + .roles(roles) |
| 66 | + .build(); |
| 67 | +``` |
| 68 | + |
| 69 | +### 2. Connection attribute `identifier` is split by attribute type |
| 70 | + |
| 71 | +The shared `ConnectionAttributeIdentifier` type is removed and replaced with dedicated types per attribute. The `identifier` field on `EmailAttribute`, `PhoneAttribute`, and `UsernameAttribute` now uses the matching type, so their `getIdentifier()` and builder `identifier(...)` signatures change. |
| 72 | + |
| 73 | +| Attribute | v3 identifier type | v4 identifier type | |
| 74 | +|-----------|--------------------|--------------------| |
| 75 | +| `EmailAttribute` | `ConnectionAttributeIdentifier` | `EmailAttributeIdentifier` | |
| 76 | +| `PhoneAttribute` | `ConnectionAttributeIdentifier` | `PhoneAttributeIdentifier` | |
| 77 | +| `UsernameAttribute` | `ConnectionAttributeIdentifier` | `UsernameAttributeIdentifier` | |
| 78 | + |
| 79 | +**v3:** |
| 80 | +```java |
| 81 | +public Optional<ConnectionAttributeIdentifier> getIdentifier() { ... } |
| 82 | +``` |
| 83 | + |
| 84 | +**v4 (`EmailAttribute`):** |
| 85 | +```java |
| 86 | +public Optional<EmailAttributeIdentifier> getIdentifier() { ... } |
| 87 | +``` |
| 88 | + |
| 89 | +Update your imports and any variables holding the identifier. The new types expose `active` (`Optional<Boolean>`); `EmailAttributeIdentifier` and `PhoneAttributeIdentifier` additionally expose a `defaultMethod` (`DefaultMethodEmailIdentifierEnum` / `DefaultMethodPhoneNumberIdentifierEnum`). |
| 90 | + |
| 91 | +```java |
| 92 | +// v4 |
| 93 | +EmailAttribute email = EmailAttribute.builder() |
| 94 | + .identifier(EmailAttributeIdentifier.builder() |
| 95 | + .active(true) |
| 96 | + .build()) |
| 97 | + .build(); |
| 98 | +``` |
| 99 | + |
| 100 | +### 3. Phone provider protection backoff strategy enum value changed |
| 101 | + |
| 102 | +`PhoneProviderProtectionBackoffStrategyEnum.NONE` (`"none"`, `visitNone()`) is removed and replaced by `PhoneProviderProtectionBackoffStrategyEnum.DEFAULT` (`"default"`, `visitDefault()`). |
| 103 | + |
| 104 | +**v3:** |
| 105 | +```java |
| 106 | +PhoneProviderProtectionBackoffStrategyEnum strategy = PhoneProviderProtectionBackoffStrategyEnum.NONE; |
| 107 | +``` |
| 108 | + |
| 109 | +**v4:** |
| 110 | +```java |
| 111 | +PhoneProviderProtectionBackoffStrategyEnum strategy = PhoneProviderProtectionBackoffStrategyEnum.DEFAULT; |
| 112 | +``` |
| 113 | + |
| 114 | +If you implement the visitor interface, rename `visitNone()` to `visitDefault()`. |
| 115 | + |
| 116 | +### 4. Federated Connections Tokensets API removed |
| 117 | + |
| 118 | +The Federated Connections Tokensets API is removed. The following are no longer available: |
| 119 | + |
| 120 | +- Client accessor: `client.users().federatedConnectionsTokensets()` (and its async/raw variants) |
| 121 | +- Types: `FederatedConnectionTokenSet`, `ConnectionFederatedConnectionsAccessTokens` |
| 122 | + |
| 123 | +**v3:** |
| 124 | +```java |
| 125 | +List<FederatedConnectionTokenSet> tokensets = |
| 126 | + client.users().federatedConnectionsTokensets().list("user_id"); |
| 127 | + |
| 128 | +client.users().federatedConnectionsTokensets().delete("user_id", "tokenset_id"); |
| 129 | +``` |
| 130 | + |
| 131 | +**v4:** |
| 132 | + |
| 133 | +No replacement is generated in the SDK. Remove these calls; if you still need this functionality, call the corresponding Management API endpoint directly. |
| 134 | + |
| 135 | +## Other changes |
| 136 | + |
| 137 | +These are backward-compatible but worth noting. |
| 138 | + |
| 139 | +### Per-request retry configuration |
| 140 | + |
| 141 | +Requests now honor a per-request `maxRetries` value via `RequestOptions`, alongside the existing `timeout`: |
| 142 | + |
| 143 | +```java |
| 144 | +GetUserResponseContent user = client.users().get( |
| 145 | + "user_id", |
| 146 | + GetUserRequestParameters.builder().build(), |
| 147 | + RequestOptions.builder() |
| 148 | + .timeout(10) |
| 149 | + .maxRetries(2) |
| 150 | + .build() |
| 151 | +); |
| 152 | +``` |
| 153 | + |
| 154 | +### Query parameter serialization |
| 155 | + |
| 156 | +List/query parameter types (e.g. `ListUsersRequestParameters`, `ListClientsRequestParameters`, `ListLogsRequestParameters`, `ListConnectionsQueryParameters`) now serialize their optional/nullable query parameters through a nullable-nonempty filter instead of being marked `@JsonIgnore`. Builder usage is unchanged; this only affects how parameters are emitted on the wire. |
| 157 | + |
| 158 | +## Migration steps |
| 159 | + |
| 160 | +1. Update the dependency to the `v4` release. |
| 161 | +2. Replace any `ConnectionAttributeIdentifier` imports/usages with the matching `EmailAttributeIdentifier`, `PhoneAttributeIdentifier`, or `UsernameAttributeIdentifier`. |
| 162 | +3. Remove `Optional` handling around `ListRolesOffsetPaginatedResponseContent#getStart/getLimit/getTotal`, and update any builder usage to the staged `start` → `limit` → `total` form. |
| 163 | +4. Replace `PhoneProviderProtectionBackoffStrategyEnum.NONE` with `DEFAULT` (and `visitNone()` with `visitDefault()` in any visitor implementations). |
| 164 | +5. Remove any usage of `client.users().federatedConnectionsTokensets()` and the `FederatedConnectionTokenSet` / `ConnectionFederatedConnectionsAccessTokens` types. |
| 165 | +6. Run `mvn verify` (or your build) and fix any remaining compilation errors surfaced by the above. |
0 commit comments