
Milestone
SDK [2.0.0-RELEASE]
2.0.0-RELEASE is a major milestone for ApiHug, introducing numerous breaking changes to pave the way for a next-generation, LLM-friendly API specification and tooling ecosystem.
😆 Guide:
⚠️⚠️⚠️ Do NOT upgrade to Spring Boot 4.0+ (as of December 2025) — the SDK is not yet compatible due to breaking changes introduced in Spring Boot 4.0. ⚠️⚠️⚠️
Attempting to do so may result in severe and difficult-to-diagnose build or runtime errors.
For details on the extensive breaking changes, please refer to the official:
Spring Boot 4.0 Migration Guide
oneof construct.allOf to unwrap and simplify response wrappers.Refer apihug-demo/libs.versions.toml
{PROJECT_ROOT}/gradle/libs.versions.toml find apihug = "1.0.0-RELEASE" please upgrade to 2.0.0-RELEASE+1.0.0+ ApiHug - API design Copilot<4.0, better 3.8~ as the spring boot 4.0 has break change!!wire or stub command_*_): any directory whose name is wrapped with leading and trailing underscores
(for example _api_) is created by the apihug tools and is read-only.java and proto are intended for developer-authored
source code and schemas.java..proto files) should live under proto.src/main)The production source layout is:
src/main/
java/ → Core application logic (hand-written Java code)
_api_/ → Java classes generated from Wire/contract definitions (production code, read-only)
proto/ → `.proto` schema files (treated as resources for code generation)
Gradle is configured so that:
src/main/_api_ is added to sourceSets.main.java.srcDirs and compiled as part of the main Java sources.src/main/proto is added to sourceSets.main.resources.srcDir and included as resources, allowing code generators
or tools to read the .proto files at build time.src/test)The test layout extends the same conventions to test code:
src/test/
java/ → Standard unit & integration tests (JUnit, etc.)
_api_/ → API guardian/contract tests compiled and run as part of the `test` task
Gradle is configured so that src/test/_api_ is added to sourceSets.test.java.srcDirs, meaning these tests are
compiled and executed together with the standard test sources.
src/test-kola)Kola tests use a dedicated source set and task to model contract-style, end-to-end tests.
src/
main/
java/ // Production Java source code
resources/ // Production resources
test/
java/ // Standard unit/integration tests (JUnit, etc.)
resources/ // Resources for standard tests
test-kola/
java/ // Auto-generated Java test classes (compiled and executed)
groovy/ // Groovy DSL files (treated as resources; NOT compiled)
resources/ // Additional test resources (contracts, fixtures, configs)
The Gradle configuration defines a testKola source set:
src/test-kola/java is used for generated Java test classes.src/test-kola/resources and src/test-kola/groovy are both registered as resource directories.groovy are not compiled; they are read by generators or test tooling at build time.testKola classpath includes outputs from both main and test source sets, so helper utilities and base
test classes can be reused.A dedicated testKola Gradle task runs only the Kola-generated tests using JUnit Platform, while the standard test
task also uses JUnit Platform for consistency.
_api_ sources by hand; instead, change proto/contracts and re-run generation.src/main/java and tests in src/test/java.src/main/proto, and Kola DSL scripts in src/test-kola/groovy.test for regular unit/integration tests and testKola for contract-style, end-to-end verification._*_): any directory whose name is wrapped with leading and trailing underscores
(for example _api_, _mcp_, _domain_, _cloud_) is created by the apihug tools and is read-only.java and trait are intended for developer-authored
source code.src/main)The production source layout is intentionally split across several directories:
src/main/
java/ → Hand-written business logic, services, controllers, etc.
_api_/ → Generated DTOs and REST interfaces (apihug-generated, read-only)
trait/ → Shared mixin/trait classes that can be customized by developers
_mcp_/ → Generated microservice contract or protocol code (read-only)
_domain_/ → Generated core domain models, aggregates, value objects (read-only)
_cloud_/ → Generated cloud/integration stubs, endpoints, or adapters (read-only)
Although the sources are physically split across multiple directories, they all belong to the same production
module. Gradle is configured to add these directories to sourceSets.main.java.srcDirs, so all of them are
compiled together into a single JAR.
src/test)The test layout mirrors the production structure to keep tests close to the code they validate:
src/test/
java/ → Unit and integration tests for core logic
_api_/ → Contract/guardian tests for the API layer (often using generated DTOs)
trait/ → Tests for trait/mixin behavior
_mcp_/ → Validation tests for protocol contracts
_domain_/ → Domain model invariant and behavior tests
_cloud_/ → Cloud/integration contract tests and generated stubs
All of these directories are registered in sourceSets.test.java.srcDirs, so the tests are compiled and executed
as part of the standard Gradle test task and share the same classpath (main + test outputs and test dependencies).
_api_, _mcp_, _domain_, _cloud_). Instead, change the underlying
contract or generation inputs and re-run the generator.java and trait so that changes are stable across code generation runs.src/test to keep production and test code aligned in structure.// old
import "extend/version.proto";
import "swagger/annotations.proto";
import "extend/domain.proto";
// new
import "apihug/protobuf/extend/version.proto";
import "apihug/protobuf/swagger/annotations.proto";
import "apihug/protobuf/extend/domain.proto";
Syntax
oneof — OASinternal/external/hide API markerswire projects support the protoImport syntax to import third-party proto dependenciesstub projects support the wireImport syntax to import wire module dependencies; using implementation causes no syntax error but results in empty compilation for the stub command