Schema Lifecycle Management: Draft, Review, Approve, Publish, Deprecate, Retire
Learn Java API Contract Engineering, Event Contract Engineering & Schema Governance - Part 024
Schema lifecycle management for Java enterprise platforms: draft, review, approve, publish, deprecate, retire, ownership, stewardship, changelog, migration notes, auditability, and workflow automation.
Part 024 — Schema Lifecycle Management: Draft, Review, Approve, Publish, Deprecate, Retire
Tujuan Pembelajaran
Schema dan contract tidak hanya “dibuat lalu dipakai”. Di enterprise system, schema punya lifecycle:
draft -> review -> approved -> published -> stable -> deprecated -> retired
Tanpa lifecycle, registry menjadi kuburan artifact:
- schema tidak jelas owner-nya;
- experimental schema dipakai production;
- deprecated field dihapus tanpa migrasi;
- old schema hilang sehingga replay gagal;
- partner membaca contract yang belum approved;
- topic/event tidak jelas apakah stable atau temporary;
- breaking changes terjadi tanpa governance evidence.
Part ini membahas schema lifecycle management sebagai operating model.
Setelah part ini, kamu harus mampu:
- mendesain state machine lifecycle untuk schema/API/event contracts;
- menentukan entry/exit criteria setiap lifecycle state;
- mengelola ownership, stewardship, and approval workflow;
- membuat changelog dan migration notes yang berguna;
- menghubungkan lifecycle dengan registry metadata, catalog, CI, and runtime gates;
- mendesain deprecation and retirement process;
- membuat audit trail untuk regulatory defensibility;
- menghindari lifecycle anti-pattern seperti “deprecated forever” dan “experimental in production”.
1. Why Lifecycle Matters
Contract lifecycle menjawab:
- bolehkah schema dipakai production?
- siapa owner-nya?
- apakah schema masih experimental?
- apakah consumer baru boleh onboard?
- apakah ada replacement?
- kapan old version akan sunset?
- apakah event masih dipublish?
- apakah old schema masih bisa dipakai replay?
- apakah perubahan sudah approved?
- apakah governance evidence tersedia?
Without lifecycle, every artifact becomes ambiguous.
2. Contract Artifact Classes
Lifecycle applies to many artifact types:
| Artifact | Lifecycle needed? |
|---|---|
| Avro schema | yes |
| Protobuf schema | yes |
| JSON Schema | yes |
| OpenAPI spec | yes |
| AsyncAPI spec | yes |
| event type | yes |
| Kafka topic contract | yes |
| error code taxonomy | yes |
| common metadata schema | yes |
| SDK generated artifact | yes |
| examples/golden samples | yes |
| deprecation record | yes |
A schema version can be retired while artifact identity remains active. Be precise.
3. Lifecycle States
3.1 Draft
Purpose:
Design work in progress.
Allowed:
- editing freely;
- local validation;
- discussion with reviewers;
- not used by production consumers.
Entry:
- author creates new schema/contract proposal.
Exit criteria:
- owner assigned;
- artifact identity proposed;
- schema validates;
- examples included;
- compatibility classification stated;
- review request opened.
Metadata:
lifecycle: draft
ownerTeam: case-management-platform
3.2 In Review
Purpose:
Formal review by owner/platform/domain/security as needed.
Checks:
- naming;
- semantics;
- compatibility;
- schema validity;
- examples;
- topic/key;
- security/data classification;
- consumer impact;
- migration plan if needed.
Exit:
- approved;
- changes requested;
- rejected.
3.3 Approved
Purpose:
Design accepted, not yet published/released.
Approved artifact should be immutable except for metadata corrections.
Exit criteria to publish:
- CI passed;
- schema registered to target environment;
- docs/catalog generated;
- release notes ready;
- runtime producer/consumer integration ready.
3.4 Published
Purpose:
Artifact is available in registry/catalog/artifact repository.
Published does not always mean production traffic exists.
Examples:
- OpenAPI spec published;
- schema registered in prod registry;
- AsyncAPI page visible;
- Java SDK artifact released.
3.5 Stable
Purpose:
Supported for production use and compatibility-governed.
Stable contract promises:
- compatibility policy enforced;
- breaking changes require migration;
- owner accountable;
- docs maintained;
- examples valid;
- telemetry monitored.
3.6 Deprecated
Purpose:
Still works, but new consumers should not adopt.
Deprecation requires:
- replacement or explanation;
- migration guide;
- known consumers;
- telemetry;
- owner;
- target sunset or condition;
- changelog.
Deprecated is not removed.
3.7 Retired
Purpose:
No longer supported for new production use.
For API endpoint: not available or removed.
For event type: no longer published.
For schema: no new writes use it, but old schema may remain readable for replay.
Retired does not always mean deleted.
3.8 Archived
Purpose:
Preserved for audit/history/replay but hidden from normal discovery.
Archived artifact may be read-only and retained for compliance.
4. Lifecycle Metadata Model
Example:
artifactId: com.acme.case.events.CaseApproved
artifactType: AVRO
lifecycle: stable
ownerTeam: case-management-platform
steward: jane.doe@acme.com
domain: case-management
introducedAt: 2026-06-29
approvedAt: 2026-06-25
publishedAt: 2026-06-29
compatibility: BACKWARD_TRANSITIVE
dataClassification: confidential
pii: false
consumerVisibility: internal
reviewRecord: CDR-2026-06-20-004
changelog: ./CHANGELOG.md
For deprecated:
lifecycle: deprecated
deprecatedSince: 2027-01-31
replacement: com.acme.case.events.CaseApprovalDecisionRecorded
sunsetTarget: 2027-12-31
removalCondition: no consumer traffic for 90 days
migrationGuide: https://developer.acme.com/migrations/case-approved
5. Ownership and Stewardship
5.1 Owner
Owner team is accountable for:
- semantic correctness;
- compatibility;
- lifecycle decisions;
- consumer communication;
- deprecation/migration;
- incident response.
5.2 Steward
Steward is a named role/person or rotating role responsible for day-to-day contract hygiene.
Steward tasks:
- review PRs;
- update catalog;
- monitor deprecated usage;
- ensure examples valid;
- coordinate consumers;
- manage exceptions;
- maintain changelog.
5.3 Platform Team
Platform team owns:
- registry infrastructure;
- lint rules;
- CI templates;
- compatibility tooling;
- catalog integration;
- policy-as-code;
- governance dashboards.
Platform should enable, not become bottleneck for every safe change.
6. Lifecycle State Machine with Gates
Each transition must be auditable.
7. Draft State Entry Checklist
Before review:
- artifact name proposed;
- owner team assigned;
- artifact type known;
- schema syntax valid;
- examples provided;
- lifecycle target defined;
- data classification proposed;
- compatibility impact estimated;
- topic/channel/API path identified;
- consumer assumptions written;
- source/authority defined for events;
- error semantics defined for APIs;
- generated code impact considered.
Drafts without owner should not enter formal review.
8. Review State Checklist
Review dimensions:
8.1 Contract Semantics
- What does this schema/event/API mean?
- Who is authority?
- What may consumers assume?
- What must consumers not assume?
- Is name accurate?
8.2 Compatibility
- Is this new artifact or change?
- Is it safe/dangerous/breaking?
- Does registry compatibility pass?
- Does semantic compatibility pass?
- Are old examples preserved?
8.3 Operational
- Topic/key/retention/order documented?
- Error/retry/idempotency documented?
- Replay requirements clear?
- DLQ behavior clear?
8.4 Security/Data
- Classification correct?
- PII present?
- Consumers authorized?
- Retention policy aligned?
- DLQ/data lake handling considered?
8.5 Tooling
- Lint passes?
- Generated code compiles?
- Examples validate?
- AsyncAPI/OpenAPI links valid?
- Catalog metadata complete?
9. Approval Criteria
A contract is approved when:
- owner accepts semantic responsibility;
- required reviewers approve;
- compatibility classification is recorded;
- high-risk changes have decision record;
- schema validates;
- examples validate;
- security metadata complete;
- migration plan exists if needed;
- rollback plan exists for risky rollout;
- CI gates pass.
Approval is not just a GitHub “LGTM”. It is a governance event.
Approval record:
approval:
artifact: com.acme.case.events.CaseApproved
version: 7
approvedAt: 2026-06-29T05:00:00Z
approvedBy:
- case-platform-owner
- schema-governance-reviewer
decisionRecord: CDR-2026-06-29-002
riskBand: medium
10. Publishing
Publishing means artifact becomes available to intended audience.
Publishing actions:
- register schema in registry;
- publish OpenAPI/AsyncAPI docs;
- publish generated client/stub if applicable;
- update event catalog;
- update changelog;
- tag/release contract repository;
- notify consumers if needed;
- update examples;
- update SDK version;
- update registry metadata.
10.1 Immutable Published Versions
Published schema versions should be immutable.
Bad:
Edit schema version 7 in place.
Better:
Publish version 8.
If metadata correction is needed, make metadata changes separately and audit them. Do not mutate schema content.
11. Stable State Responsibilities
Stable artifacts require ongoing maintenance.
Owner responsibilities:
- monitor usage;
- maintain docs;
- keep examples valid;
- respond to issues;
- review changes;
- maintain compatibility;
- publish changelogs;
- manage deprecations;
- support replay;
- participate in incidents.
Stable is not “done”. Stable means supported.
12. Deprecation
Deprecation is a lifecycle state with rules.
12.1 Deprecation Requirements
Do not deprecate without:
- reason;
- replacement or explanation why none;
- migration guide;
- known consumer list;
- telemetry plan;
- target sunset or removal condition;
- owner;
- support contact;
- changelog entry.
12.2 Deprecation Record
deprecation:
artifact: com.acme.customer.events.CustomerActivated
deprecatedSince: 2026-06-29
reason: Event overloaded lifecycle activation and transaction access.
replacement:
- com.acme.customer.events.CustomerLifecycleActivated
- com.acme.customer.events.CustomerTransactionAccessGranted
ownerTeam: customer-platform
knownConsumers:
- onboarding-service
- crm-sync
- case-management-service
sunsetTarget: 2027-03-31
removalCondition: no production consumption for 90 days
migrationGuide: https://developer.acme.com/migrations/customer-activated
12.3 Deprecation Communication
Communication channels:
- catalog banner;
- changelog;
- PR/release notes;
- email/Slack to known consumers;
- SDK deprecation annotations;
- API response headers if HTTP;
- AsyncAPI/OpenAPI deprecated flags;
- dashboard.
13. Retirement
Retirement is not deletion.
13.1 Retirement for API
- endpoint no longer available;
- gateway route disabled;
- SDK method removed in major version;
- docs archived.
13.2 Retirement for Event Type
- producer no longer publishes event;
- old schema remains readable;
- topic may remain for other event types;
- catalog marks retired;
- replay tools still understand old event if needed.
13.3 Retirement for Schema Version
- no new producer uses version;
- registry still stores version;
- old messages can deserialize;
- artifact hidden from default docs if needed.
13.4 Retirement Preconditions
- replacement stable;
- consumers migrated;
- telemetry shows no active use or exceptions approved;
- deprecation window satisfied;
- replay/archive plan exists;
- rollback plan exists;
- owner approval;
- registry/catalog updated;
- support team informed.
14. Archive
Archived artifacts are retained for:
- audit;
- replay;
- incident investigation;
- legal/regulatory evidence;
- migration reference.
Archived should be:
- read-only;
- searchable by ID;
- hidden from normal onboarding;
- linked to retirement record;
- retained according to policy.
Do not hard-delete production schemas that may be referenced by old messages.
15. Lifecycle for Experimental Contracts
Experimental contract is allowed only with controls.
Metadata:
lifecycle: experimental
expiresAt: 2026-09-30
allowedConsumers:
- fraud-research-service
productionUseAllowed: false
compatibilityGuarantee: none-or-limited
Rules:
- visible as experimental;
- limited consumers;
- expiry date;
- no tier-1 dependency;
- no partner/public use;
- migration or deletion at expiry;
- not promoted to stable silently.
Anti-pattern:
Experimental event becomes de facto production contract because nobody cleaned it up.
16. Lifecycle for Common Schemas
Common schemas need stricter lifecycle:
EventMetadata;Money;Problem;Address;IdentityRef;Pagination;AuditActor.
Because blast radius is high.
Change requirements:
- dependency graph impact analysis;
- transitive compatibility;
- sample validation across dependents;
- platform review;
- rollout guide;
- versioned common schema strategy.
Common schema should rarely be experimental if used by stable artifacts.
17. Changelog
Every artifact should have changelog.
Good changelog entry:
## 1.4.0 - 2026-06-29
### Added
- Added optional `payload.reasonCode` to `CaseApproved`.
### Compatibility
- Backward-compatible for new consumers reading old events.
- Forward-compatible if old consumers ignore unknown fields.
- No Kafka key/topic/retention change.
### Migration
- Consumers may continue ignoring `reasonCode`.
- New consumers should treat missing `reasonCode` as `UNKNOWN`.
### Governance
- Approved by case-management-platform.
- Decision record: CDR-2026-06-29-002.
Bad:
Updated schema.
Changelog should answer “what changed and what should I do?”
18. Migration Notes
Migration guide for breaking/dangerous changes should include:
- old contract;
- new contract;
- why change exists;
- compatibility classification;
- timeline;
- step-by-step consumer migration;
- code examples;
- testing guidance;
- rollback;
- support contact.
Example:
# Migration: CustomerActivated to CustomerLifecycleActivated
## Why
`CustomerActivated` mixed lifecycle and transaction access semantics.
## Old
Consume `CustomerActivated`.
## New
Consume:
- `CustomerLifecycleActivated` for lifecycle state;
- `CustomerTransactionAccessGranted` for transaction permission.
## Timeline
- 2026-06-29: dual publish starts
- 2027-01-31: new consumers blocked from old event
- 2027-03-31: old event publication target sunset
## Consumer Steps
1. Add handler for new event.
2. Deduplicate side effects by customerId + transition.
3. Deploy with both handlers.
4. Verify metrics.
5. Remove old handler after confirmation.
19. Registry Metadata and Lifecycle
Registry should store lifecycle metadata.
Example:
artifactMetadata:
lifecycle: deprecated
deprecatedSince: 2026-06-29
replacementArtifact: com.acme.customer.events.CustomerLifecycleActivated
ownerTeam: customer-platform
migrationGuide: https://developer.acme.com/migrations/customer-activated
CI should block:
- stable artifact without owner;
- deprecated artifact without replacement/reason;
- experimental artifact without expiry;
- retired artifact with active producer;
- artifact with lifecycle mismatch between registry and catalog.
20. Catalog Lifecycle Display
Catalog should visually show lifecycle:
CaseApproved
Status: Stable
Owner: case-management-platform
Compatibility: BACKWARD_TRANSITIVE
Consumers: 12
Last changed: 2026-06-29
Deprecated:
CustomerActivated
Status: Deprecated
Replacement: CustomerLifecycleActivated, CustomerTransactionAccessGranted
Sunset target: 2027-03-31
Migration guide: ...
Experimental:
FraudSignalObserved
Status: Experimental
Expires: 2026-09-30
Allowed consumers: fraud-research-service
Lifecycle must be visible to prevent accidental adoption.
21. Lifecycle Automation
Automate reminders and gates.
21.1 CI Gates
Fail if:
- lifecycle missing;
- owner missing;
- experimental expiry missing;
- deprecated replacement missing;
- stable artifact has compatibility NONE;
- retired artifact still referenced by active AsyncAPI;
- new consumer subscribes to deprecated event without waiver;
- schema changed without changelog.
21.2 Scheduled Checks
Daily/weekly job:
- list expiring experimental artifacts;
- list deprecated artifacts past sunset;
- list exceptions expiring;
- list schemas without usage;
- list stable artifacts without examples;
- list retired artifacts still receiving traffic;
- notify owners.
21.3 Runtime Checks
Producer startup can warn/fail if attempting to publish retired artifact.
Consumer onboarding can block deprecated artifact unless approved.
22. Lifecycle and Consumer Onboarding
When a consumer wants to use event/API:
- check lifecycle;
- check data classification;
- check access approval;
- check compatibility guarantee;
- check deprecation status;
- register consumer identity;
- link consumer to artifact;
- define usage fields;
- define side effects;
- define support contact.
For deprecated artifact:
new consumers blocked unless exception approved.
For experimental artifact:
only allowed consumers.
For stable artifact:
onboarding allowed subject to access/security.
23. Lifecycle and Runtime Telemetry
Telemetry needed for lifecycle decisions:
- API endpoint traffic;
- field usage if measurable;
- event consumption by group;
- schema version usage;
- producer schema version;
- deprecated artifact usage;
- consumer lag;
- DLQ errors by event type;
- SDK version adoption;
- unknown consumer detection.
Without telemetry, retirement is guesswork.
24. Audit Trail
Audit should capture:
- proposal author;
- reviewers;
- approval decision;
- compatibility classification;
- schema diff;
- metadata changes;
- registry version IDs;
- promotion environments;
- deprecation notice;
- retirement decision;
- exception approvals;
- consumer migration evidence.
Audit record example:
auditEvent:
type: CONTRACT_VERSION_PUBLISHED
artifact: com.acme.case.events.CaseApproved
version: 7
actor: ci-contract-publisher
timestamp: 2026-06-29T05:00:00Z
sourceCommit: abc123
buildId: contract-build-9821
approvalRecord: CDR-2026-06-29-002
This makes governance defensible.
25. Lifecycle Incident Scenarios
25.1 Experimental Used by Production
Cause:
- lifecycle not visible;
- onboarding not controlled;
- no expiry check.
Fix:
- mark artifact blocked for new consumers;
- identify consumers;
- decide promote-to-stable or migrate off;
- add lifecycle gate.
25.2 Deprecated Removed Too Early
Cause:
- no telemetry;
- owner assumed no usage.
Fix:
- restore old contract if possible;
- notify impacted consumers;
- add retirement preconditions;
- add usage dashboard.
25.3 Schema Deleted
Cause:
- registry cleanup job;
- misunderstanding retirement.
Fix:
- restore registry backup;
- re-register old schema if IDs allow;
- verify replay;
- block hard delete.
25.4 Common Schema Change Breaks Many Events
Cause:
- no dependency graph.
Fix:
- rollback common schema version;
- rebuild dependent artifacts;
- add dependency impact analysis.
26. Lifecycle Policy Template
schemaLifecyclePolicy:
requiredMetadata:
- lifecycle
- ownerTeam
- artifactType
- dataClassification
states:
draft:
productionUse: false
inReview:
productionUse: false
requiresReviewers: true
approved:
mutableSchemaContent: false
published:
registryVisible: true
catalogVisible: true
stable:
compatibilityRequired: true
breakingChangeRequiresMigration: true
experimental:
expiryRequired: true
allowedConsumersRequired: true
deprecated:
replacementOrReasonRequired: true
migrationGuideRequired: true
usageTelemetryRequired: true
retired:
newProductionUse: false
runtimePublishAllowed: false
schemaReadableForReplay: true
archived:
readOnly: true
deletion:
productionSchemaHardDeleteAllowed: false
27. Lifecycle Repository Layout
contracts/
├── schemas/
│ ├── case/
│ │ ├── CaseApproved.avsc
│ │ ├── CaseSubmitted.avsc
│ │ └── metadata.yaml
│ └── common/
│ ├── EventMetadata.avsc
│ └── Money.avsc
├── asyncapi/
│ └── case-events.yaml
├── lifecycle/
│ ├── artifacts.yaml
│ ├── deprecations.yaml
│ ├── exceptions.yaml
│ └── retirements.yaml
├── decisions/
│ └── CDR-2026-06-29-002.md
├── examples/
│ └── case-approved-v1.json
└── CHANGELOG.md
Keep lifecycle metadata near contracts, not hidden in spreadsheets.
28. Lifecycle Review Checklist
28.1 New Artifact
- Owner assigned?
- Lifecycle target?
- Artifact name stable?
- Data classification?
- Examples?
- Compatibility policy?
- Catalog metadata?
- Consumer assumptions?
28.2 Change Existing Artifact
- Current lifecycle?
- Compatibility classification?
- Changelog updated?
- Decision record needed?
- Examples updated?
- Consumers impacted?
- Migration needed?
- Registry compatibility passes?
28.3 Deprecation
- Reason?
- Replacement?
- Migration guide?
- Known consumers?
- Telemetry?
- Sunset target?
- Owner?
28.4 Retirement
- Usage zero or exception approved?
- Replacement stable?
- Replay/archive support?
- Old schema retained?
- Catalog updated?
- Runtime publishing blocked?
- Rollback plan?
29. Lifecycle Anti-Patterns
29.1 Stable by Accident
Schema used in production before review.
29.2 Experimental Forever
No expiry and no owner.
29.3 Deprecated Forever
No migration, no sunset, no telemetry.
29.4 Retired Means Deleted
Old messages become unreadable.
29.5 Ownerless Contract
Nobody reviews or supports it.
29.6 Changelog Useless
“Updated schema.”
29.7 Lifecycle Only in Wiki
CI/runtime cannot enforce.
29.8 Approval Without Evidence
No compatibility classification or diff.
29.9 New Consumers on Deprecated Contract
Debt grows after deprecation.
29.10 Common Schema Change Without Dependent Tests
Blast radius ignored.
30. Practice Lab
Lab 1 — State Machine
Design lifecycle state machine for:
new event type -> stable -> deprecated -> retired -> archived
Include entry/exit criteria.
Lab 2 — Deprecation Record
Write deprecation record for CustomerActivated.
Include replacement, reason, known consumers, sunset target, migration guide, and removal condition.
Lab 3 — Retirement Gate
Define retirement checklist for event LegacyCaseUpdated.
Lab 4 — Lifecycle Policy
Write YAML policy that blocks:
- experimental artifact without expiry;
- deprecated artifact without migration guide;
- stable artifact with compatibility NONE;
- retired event still being published;
- schema deletion for production artifacts.
Lab 5 — Audit Trail
Design audit record for publishing CaseApproved schema version 7.
Lab 6 — Incident Response
A deprecated event was removed but one tier-1 consumer still uses it. Write incident response and prevention changes.
31. Senior Engineer Heuristics
- Schema lifecycle is contract lifecycle.
- Draft contracts must not become accidental production contracts.
- Stable means supported, not finished.
- Deprecated means still works.
- Retired does not mean deleted.
- Experimental requires expiry.
- Every contract needs an owner.
- Common schemas need stricter lifecycle control.
- Changelog must tell consumers what to do.
- Migration guide is part of breaking-change governance.
- Lifecycle must be machine-readable.
- Retirement without telemetry is unsafe.
- Archive old schemas for replay and audit.
- Lifecycle transitions should be auditable events.
- Good lifecycle management turns governance from meetings into durable system behavior.
32. Summary
Schema lifecycle management gives contracts a controlled path from draft to review, approval, publication, stability, deprecation, retirement, and archive. It prevents experimental artifacts from becoming accidental production dependencies and prevents deprecated artifacts from being removed without evidence.
Main takeaways:
- lifecycle state must be explicit and machine-readable;
- draft and experimental contracts need production-use controls;
- stable contracts require compatibility guarantees and owner accountability;
- deprecation requires replacement, migration guide, telemetry, and sunset conditions;
- retirement should preserve old schemas for replay/audit;
- ownership and stewardship are mandatory;
- changelogs and migration notes are part of contract quality;
- registry/catalog/CI/runtime should all understand lifecycle;
- lifecycle transitions must leave audit evidence;
- lifecycle governance keeps long-lived API/event platforms maintainable.
Part berikutnya membahas contract review playbook: what senior engineers actually look for when reviewing API contracts, event contracts, schema changes, compatibility risks, security/data classification, error semantics, and consumer ergonomics.
You just completed lesson 24 in deepen practice. Use the series map if you want to review the broader track, or continue directly into the next lesson while the context is still warm.
Keep the momentum while the lesson is still fresh. Move backward for review or continue forward into the next concept.