Read this file first. It tells you where to find context in this repo.
| What you need | Where to look |
|---|---|
| How this repo is structured | ARCHITECTURE.md |
| How to build/test/run | CONTRIBUTING.md |
| Why decisions were made | docs/ADRs/ |
| What this repo does | README.md |
| PR review rules | .bito/guidelines/ |
| Active specs/work | docs/specs/ |
- Never call environment-scoped operations on the wrong modules. The modules
apiKeys,previewApiKeys,roles,spaceMemberships,uploads, andwebhooksthrowCMANotWithEnvironmentsExceptionif the client is configured with a non-masterenvironmentId. Always use a separate client (noenvironmentId) for those modules. - Java 8 is the minimum target — do not use Java 9+ APIs in production code. The Android dependency (
com.google.android:android) is markedoptionalbut must remain compilable on API 21+. Tests may use newer JVM features. - Do not add new runtime dependencies without an ADR. The dependency footprint is deliberately small to keep Android app size predictable.
- Every Module must extend
AbsModule<T>. The base class handles argument validation, executor injection, and space/environment ID pre-configuration. Never bypass it. - Custom Gson adapters must be registered in
CMAClient. The Gson instance is built once inCMAClientand shared across all modules. New model types with non-trivial wire formats need a type adapter registered there. - RichText hierarchy rules are enforced by the API — the SDK models them but does not validate at write time. Violating the hierarchy (Document in Document, Link outside Paragraph, etc.) will produce a 422 from the CMA. See
ARCHITECTURE.mdfor the full rule set. - The
CMACallback.onFailure()default implementation is empty. Code that needs to handle failures must override it explicitly. This is a common source of silently dropped errors. - Test files are Kotlin; production code is Java. Keep this split. Do not introduce Kotlin into
src/main/java/. - Public API surface is stable — treat changes as breaking. All
CMA*model classes,CMAClientbuilder methods, andModule*public methods are part of the published API. Removing, renaming, or adding required parameters to any of these is a breaking change and requires a semver major bump. Review CHANGELOG implications before modifying them. - Never log auth tokens unconditionally. The
logSensitiveDataflag inCMAClientcontrols whetherAuthorizationheaders appear in logs. Its default isfalse. Do not change that default or add unconditional logging of auth/credentials anywhere in the SDK. - Checkstyle runs during
./mvnw verify(not./mvnw test). CI only runs./mvnw -B test, so checkstyle is not enforced in CI — run./mvnw -B verifylocally before pushing to catch violations. The config is incheckstyle.xmlat the repo root.
- Commit format: Conventional Commits (
feat:,fix:,chore:,docs:, etc.) — not enforced by a hook, but followed by convention - Branch strategy:
masteris the main branch; feature/fix branches merged via PR; releases userelease/X.Y.Zbranches - Test location:
src/test/kotlin/com/contentful/java/cma/(unit) andsrc/test/kotlin/com/contentful/java/cma/e2e/(integration) - Build system: Maven Wrapper (
./mvnw) — always use the wrapper, never a system Maven install - Module pattern: One
Module*.java+ oneService*.javaper CMA resource type - Model naming: All resource model classes are prefixed
CMA(e.g.,CMAEntry,CMASpace)
Upstream (this repo consumes):
- Contentful CMA (
api.contentful.com) — all content management operations - Contentful Upload API (
upload.contentful.com) — binary asset upload
Downstream (consumes this repo):
- Java and Android applications that manage Contentful content
- Published to Maven Central as
com.contentful.java:cma-sdk
# Run tests (does NOT include checkstyle)
./mvnw -B test
# Full verification (tests + checkstyle) inside devcontainer
./mvnw -B verify