Skip to content

Add a mechanism to avoid mixing versions for a client#1167

Open
sugmanue wants to merge 8 commits intosmithy-lang:mainfrom
sugmanue:sugmanue/avoid-version-mixing
Open

Add a mechanism to avoid mixing versions for a client#1167
sugmanue wants to merge 8 commits intosmithy-lang:mainfrom
sugmanue:sugmanue/avoid-version-mixing

Conversation

@sugmanue
Copy link
Copy Markdown
Contributor

@sugmanue sugmanue commented May 2, 2026

Issue #, if available:

Description of changes:

Other SDKs have historically suffered from issues where users inadvertently mix versions of runtime libraries in their final application. This typically happens when different dependencies pull in different versions of the same module, resulting in a classpath that contains, for example, core at version 1.1.0 alongside client-http at version 1.0.9. These mismatches cause subtle runtime errors, class not found exceptions, missing methods, or unexpected behavior, that are difficult to diagnose because nothing fails at compile time.

This change adds a version compatibility test that addresses this at runtime when the codegen schema classes are loaded: if the modules on the classpath don't all agree on the same version, or if any module is older than what the client was generated against, the test fails with a clear message identifying exactly which modules are mismatched, which prevents the classloader from succeeding.

The end-user can set the java property smithy.java.skipVersionCheck to bypass this check if needed.


By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@sugmanue sugmanue enabled auto-merge (squash) May 5, 2026 01:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants