Skip to content

refactor: require explicit smithy-build.json in contracts, synthesize for server/client#46

Merged
thomaslaich merged 7 commits into
mainfrom
worktree-smithy-build
Jun 2, 2026
Merged

refactor: require explicit smithy-build.json in contracts, synthesize for server/client#46
thomaslaich merged 7 commits into
mainfrom
worktree-smithy-build

Conversation

@thomaslaich
Copy link
Copy Markdown
Owner

Summary

  • Contracts projects (SmithyPublish=true) now require an explicit smithy-build.json at the project root, so IDE tooling (Smithy VS Code / IntelliJ) can resolve traits from Maven dependencies (alloy, aws-traits, etc.) when editing .smithy files
  • Server/client projects without a local smithy-build.json get one synthesized in obj/ via a new SynthesizeSmithyBuildFile MSBuild task — reads the contracts smithy-build.json, patches sources to absolute paths, and injects the csharp-codegen Maven dep + plugin entry
  • Server/client projects that provide their own smithy-build.json continue to use it as-is (the existing eject path)
  • Removes SmithyMavenDependency, SmithyBuildSuppression, SmithyGenerateDocs, SmithyOpenApiProtocol, and SmithyVersion from the public MSBuild surface area
  • Adds SmithyCSharpCodegenVersion property (default: 0.1.0-SNAPSHOT) for pinning the injected codegen dep

Test plan

  • Build examples/simple-rest-json — contracts, server, and client should all build and codegen should succeed
  • Build examples/rest-json1 — same
  • Open a .smithy file in examples/simple-rest-json/contracts in VS Code with the Smithy extension — alloy traits (@alloy.protocols#simpleRestJson) should resolve without errors
  • Verify a server project with no smithy-build.json synthesizes one in obj/ containing the contracts' Maven deps and a csharp-codegen plugin entry
  • Verify that a contracts project without smithy-build.json (and SmithyPublish=true) produces a clear error

🤖 Generated with Claude Code

thomaslaich and others added 7 commits May 31, 2026 18:39
… for server/client

Contracts projects (SmithyPublish=true) must now have an explicit smithy-build.json
at the project root. This makes IDE tooling (Smithy VS Code / IntelliJ) able to resolve
traits from Maven dependencies (alloy, aws-traits, etc.) when editing .smithy files.

Server/client projects without a local smithy-build.json get one synthesized in obj/
by reading the contracts smithy-build.json, patching sources to absolute paths, and
injecting the csharp-codegen Maven dep and plugin entry via the new
SynthesizeSmithyBuildFile MSBuild task.

Removes SmithyMavenDependency, SmithyBuildSuppression, SmithyGenerateDocs,
SmithyOpenApiProtocol, and SmithyVersion from the public MSBuild surface area.
Adds SmithyCSharpCodegenVersion (default: 0.1.0-SNAPSHOT).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…sion

Gives users a single documented place to find which Smithy version is
bundled, so software.amazon.smithy:* Maven artifacts in contracts
smithy-build.json files can be kept in sync.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Restores docgen and openapi plugin injection into the synthesized
smithy-build.json, now handled properly in SynthesizeSmithyBuildFile
rather than via MSBuild string manipulation. Also restores
_CopyOpenApiToWwwroot and _CopyDocgenToWwwroot targets, and restores
SmithyGenerateDocs/SmithyOpenApiProtocol usage in the rest-json1 and
simple-rest-json server examples.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add smithy-build.json to contracts, standalone server, and IsMaven
  client templates; configure //#if conditional processing for them
- Remove SmithyMavenDependency items from all templates (deps now live
  in smithy-build.json)
- Remove SmithySource items from standalone server template (sources
  declared in smithy-build.json)
- Exclude smithy-build.json from server template when WithContracts,
  and from client template when not IsMaven
- Drop .m2 repository from all smithy-build.json files and from the
  synthesis default (Smithy CLI already checks it by default)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@thomaslaich thomaslaich merged commit 9ef16c2 into main Jun 2, 2026
1 check passed
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.

1 participant