This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
./gradlew build- Build all modules and run tests./gradlew test- Run unit tests across all modules./gradlew check- Run all verification tasks (tests, linting, spotbugs)./gradlew spotlessCheck- Check code formatting./gradlew spotlessApply- Apply code formatting fixes./gradlew spotbugsMain- Run SpotBugs static analysis
./gradlew :module-name:test- Run tests for a specific module (e.g.,:core:test)./gradlew :module-name:build- Build a specific module./gradlew :examples:end-to-end:smithyBuild- Generate code for examples
- Code generation happens during the
smithyBuildtask - Generated code is placed in
build/smithy/directories - Use
smithy-build.jsonfiles to configure code generation
This is a Smithy Interface Definition Language (IDL) implementation for Java with a layered architecture:
- Schema System (
core/) - Runtime representation of Smithy models with precompiled validation - Code Generation (
codegen/) - Transforms Smithy models into Java client/server code - Protocol Layer - Pluggable protocol implementations (REST JSON, RPC CBOR, AWS protocols)
- Transport Layer - HTTP and other transport implementations
- Runtime Components - Client/server frameworks that generated code depends on
Plugin Architecture: Uses Java ServiceLoader extensively for protocol, transport, and codec discovery via META-INF/services/ files.
Schema-Driven Runtime: Smithy models compile to runtime Schema objects with precomputed validations for performance.
Async-First Design: All client operations return CompletableFuture<T>, servers use job-based orchestration.
Layered Protocol Architecture:
Generated Client/Server Code
↓
Protocol Layer (REST JSON, RPC CBOR, etc.)
↓
Transport Layer (HTTP, etc.)
↓
Codec Layer (JSON, CBOR, XML)
Core Modules:
core/- Schema system, serialization, validationcodegen/- Code generation framework and pluginsclient/- Client runtime framework with protocol/transport abstractionserver/- Server framework with orchestrator pattern and handler architecture
Protocol Implementations:
client-rpcv2-cbor/- Binary RPC protocol using CBOR serializationaws/client/- AWS protocol implementations (REST JSON, REST XML, AWS JSON)codecs/- Protocol-agnostic serialization (JSON, CBOR, XML)
AWS Integration:
aws/- AWS-specific protocols, SigV4 auth, SDK v2 compatibility- Service bundling tools for packaging AWS service models
MCP Integration:
mcp/- Model Context Protocol server implementation- Supports both direct handler and proxy modes
- Input: Smithy model files (
.smithy) andsmithy-build.jsonconfiguration - Processing: CodeGenerationContext coordinates JavaSymbolProvider and specialized generators
- Output: Generated Java classes in
build/smithy/with runtime dependencies on core modules - Integration: JavaCodegenIntegration plugins extend generation process
- Uses JUnit 5 platform across all modules
- Protocol compliance testing via
protocol-test-harness - Integration tests in
src/it/directories - Examples serve as functional tests
- Java 17+ required (toolchain uses Java 21, compiles to Java 17)
- Uses Spotless for formatting with Eclipse formatter
- SpotBugs for static analysis with custom filter rules
- License headers required on all files (auto-applied by Spotless)
- Standard Gradle multi-module project
- Integration tests in
src/it/directories - Test fixtures in
src/testFixtures/where appropriate - Resources in
src/main/resources/META-INF/for service discovery
- Pre-push hooks automatically installed on Unix systems via
addGitHookstask - Requires
smithyCLI to be installed for hook execution
Service Discovery: New protocol/transport implementations must register via ServiceLoader in META-INF/services/ files.
Schema Performance: The schema system precomputes validation constraints - avoid runtime constraint compilation.
Generated Code Integration: Generated clients/servers depend on corresponding runtime modules (client-core, server-core).
Protocol Implementation: Client and server protocol implementations are separate - both sides must be implemented for full protocol support.