- Add Foundry project configuration (foundry.toml, foundry.lock) - Add Solidity contracts (TokenFactory138, BridgeVault138, ComplianceRegistry, etc.) - Add API definitions (OpenAPI, GraphQL, gRPC, AsyncAPI) - Add comprehensive test suite (unit, integration, fuzz, invariants) - Add API services (REST, GraphQL, orchestrator, packet service) - Add documentation (ISO20022 mapping, runbooks, adapter guides) - Add development tools (RBC tool, Swagger UI, mock server) - Update OpenZeppelin submodules to v5.0.0
3.4 KiB
3.4 KiB
API Versioning Policy
This document defines the versioning strategy for all API types in the eMoney Token Factory system.
Versioning Schemes
REST API
- URL-based versioning:
/v1/,/v2/, etc. - Additive changes only: New fields, endpoints, or query parameters are allowed
- Breaking changes: Require new version (e.g.,
/v2/) - Deprecation window: Minimum 6 months before removal
GraphQL API
- Schema versioning: Single schema with deprecation warnings
- Field deprecation: Use
@deprecateddirective - Breaking changes: Add new fields, deprecate old ones
- Removal: After deprecation period (minimum 6 months)
AsyncAPI
- Event type versioning:
triggers.state.updated.v1,triggers.state.updated.v2 - Event envelope: Versioned separately
- Backward compatibility: Old event types supported for 6 months
gRPC/Protobuf
- Package versioning:
emoney.orchestrator.v1,emoney.orchestrator.v2 - Service versioning: New service versions for breaking changes
- Message compatibility: Follow Protobuf compatibility rules
Breaking Change Definition
A change is considered breaking if it:
- Removes an endpoint, field, or parameter
- Changes the type of a field or parameter
- Changes the semantics of an endpoint
- Removes an enum value
- Changes authentication requirements
- Changes error response format
Non-Breaking Changes
These changes are allowed without version bump:
- Adding new endpoints
- Adding optional fields to requests/responses
- Adding new enum values
- Adding new query parameters
- Improving error messages
- Adding new response fields
Deprecation Process
- Announcement: Mark as deprecated in API documentation
- Warning Period: 6 months minimum
- Removal: Remove in next major version
GraphQL Deprecation Example
type Token {
code: String!
address: String!
oldField: String @deprecated(reason: "Use newField instead")
newField: String!
}
REST Deprecation Example
GET /v1/tokens
Deprecation: true
Sunset: 2024-07-01
Link: <https://api.emoney.example.com/docs/v2>; rel="successor-version"
Version Lifecycle
- Alpha: Internal testing only
- Beta: Public beta, may have breaking changes
- Stable: Production-ready, follows versioning policy
- Deprecated: Scheduled for removal
- Sunset: No longer supported
Migration Guide
When a new version is released:
- Provide migration guide in documentation
- Offer SDK updates
- Provide compatibility layer if possible
- Support both versions during transition period
Examples
REST API Versioning
/v1/tokens # Version 1
/v2/tokens # Version 2 (breaking changes)
/v1/tokens # Still supported during transition
GraphQL Deprecation
# v1
type Token {
oldName: String!
}
# v2 (additive)
type Token {
oldName: String! @deprecated(reason: "Use name instead")
name: String!
}
# v3 (removal)
type Token {
name: String!
}
AsyncAPI Versioning
# v1
channels:
triggers.created.v1:
# ...
# v2
channels:
triggers.created.v2:
# ...
triggers.created.v1: # Still supported
# ...
Compliance
All API changes must:
- Follow semantic versioning principles
- Maintain backward compatibility within major version
- Provide deprecation warnings before removal
- Document migration path
- Support transition period (minimum 6 months)