Skip to content

Commit 3e1e51d

Browse files
committed
Sync open source content 🐝 (from d1de271f1c2764347ba4a6ad9916fe93805ee283)
1 parent 699863e commit 3e1e51d

1 file changed

Lines changed: 31 additions & 7 deletions

File tree

docs/sdks/manage/versioning.mdx

Lines changed: 31 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,45 @@ Speakeasy-generated SDKs are automatically versioned using Semantic Versioning (
1111

1212
## Versioning logic
1313

14-
The SDK version will be automatically incremented in the following cases.
14+
The SDK version is automatically incremented based on three independent inputs: generator feature changes, OpenAPI document changes, and configuration changes. Each input is evaluated separately, and the largest bump across all three wins.
15+
16+
The precedence order is: **major > minor > patch**. For example, if generator features trigger a minor bump and the OpenAPI document triggers a major bump, the final result is a major bump.
1517

1618
### Generator version changes
1719

1820
When Speakeasy releases a new generator version, it compares the features changed in the new generator to those used in the SDK:
1921

2022
- If multiple used features in the SDK change, the largest version bump (major, minor, patch) across all used features determines the version increment.
23+
- If a generator feature that was previously tracked in `gen.lock` is no longer present, that triggers a minor bump.
2124
- Features unaffected by the new generator version maintain the current version.
2225

2326
### Configuration changes
2427

2528
- Changes to the `gen.yaml` file will bump the patch version.
26-
- Changes to the checksum will also bump the patch version.
29+
- Changes to the configuration checksum will also bump the patch version.
2730

2831
### OpenAPI document changes
2932

30-
- If the `info.version` section of the OpenAPI document is SemVer compliant, major or minor changes to the OpenAPI document will bump the major or minor version of SDKs correspondingly.
31-
- _Coming Soon_: Speakeasy will detect changes to the OpenAPI document (for example, adding a breaking change to the parameters of an operation) and bump versions accordingly.
33+
Versioning based on OpenAPI document changes works by comparing the `info.version` field between generations:
34+
35+
- If the `info.version` field is a valid SemVer string, Speakeasy compares the previous and current values. A major or minor increment in `info.version` bumps the SDK version correspondingly.
36+
- If `info.version` is not present, is not a valid SemVer string, or has not changed, Speakeasy falls back to a document checksum comparison. A checksum change triggers a patch bump.
37+
- Speakeasy does not currently analyze the actual content of the OpenAPI document (such as added or removed operations). Only the `info.version` field and the overall document checksum are evaluated.
3238

3339
## Pre-release version bumps
3440

3541
Speakeasy supports any SemVer-compatible string as a valid version, including pre-release versions such as `X.X.X-alpha` or `X.X.X-alpha.X`.
3642

37-
- Pre-release versioning continues until manual removal.
38-
- Automated bumps increment pre-release versions. For example, `1.0.0-alpha`, `1.0.0-alpha.1`, `1.0.0-alpha.2`.
39-
- To exit pre-release versioning, set a new version or run `speakeasy bump graduate`.
43+
- When the current version has a pre-release suffix (for example, `1.0.0-alpha.1`), automated bumps increment the pre-release counter instead of the main version segments. For example: `1.0.0-alpha``1.0.0-alpha.1``1.0.0-alpha.2`.
44+
- Pre-release versioning continues until explicitly exited.
45+
- To exit pre-release versioning, set a new version manually, run `speakeasy bump graduate`, or set the `SPEAKEASY_BUMP_OVERRIDE` environment variable to `graduate`. A `graduate` bump strips the pre-release suffix entirely, promoting `1.0.0-alpha.2` to `1.0.0`.
4046

4147
## Major version bumps
4248

4349
New SDKs start at version `0.0.1`. Automatic major version bumps begin after reaching version `1.0.0`. Breaking changes trigger major version increments after `1.0.0`.
4450

51+
When a major bump is detected for a pre-v1 SDK (version below `1.0.0`), Speakeasy automatically downgrades it to a minor bump. This also applies to Go SDKs regardless of version, because major version changes in Go require import path changes that significantly impact downstream users. This automatic downgrade does not apply when the bump was explicitly set via `SPEAKEASY_BUMP_OVERRIDE=major`.
52+
4553
Major version changes affect the Golang SDK migration path.
4654

4755
### Golang major version bumps
@@ -53,6 +61,22 @@ Golang module versions above `1.0.0` require import path changes to include the
5361

5462
Consider Golang SDK major version changes carefully due to migration path impacts. The SDK maintainer determines when to increment major versions.
5563

64+
## Overriding automatic versioning with an environment variable
65+
66+
Set the `SPEAKEASY_BUMP_OVERRIDE` environment variable to force a specific bump type, bypassing all automatic detection. Valid values are `patch`, `minor`, `major`, and `graduate`.
67+
68+
When set, this variable clears any bumps detected from generator features, OpenAPI document changes, or configuration changes, and applies only the specified bump type.
69+
70+
```bash
71+
# Force a minor bump regardless of detected changes
72+
SPEAKEASY_BUMP_OVERRIDE=minor speakeasy run
73+
74+
# Force graduation from pre-release
75+
SPEAKEASY_BUMP_OVERRIDE=graduate speakeasy run
76+
```
77+
78+
This is useful in CI/CD pipelines that require deterministic version control. Unlike the automatic major-bump downgrade for pre-v1 and Go SDKs, `SPEAKEASY_BUMP_OVERRIDE=major` applies the major bump as specified without any downgrade.
79+
5680
## Disabling automatic versioning
5781

5882
To permanently disable automatic version bumping, set `versioningStrategy` to `manual` in the `generation` section of your `gen.yaml` file:

0 commit comments

Comments
 (0)