Skip to content

Architecture: Formalize API versioning strategy and compatibility policy #65

@sfloess

Description

@sfloess

Overview

Define and document a formal API versioning strategy for jnexus-core to help downstream consumers manage upgrades safely.

Current State

  • Semantic versioning for releases (X.Y.Z)
  • No explicit API compatibility policy
  • No deprecation process
  • No API stability guarantees

Architecture Score Impact

Current: Architecture A (95/100)
With this: Architecture A+ (99/100)

Proposed Strategy

1. API Stability Levels

Stable API (jnexus-core):

/**
 * Stable API - backwards compatible within major version.
 * Safe to depend on in production code.
 * 
 * @since 2.0.0
 * @apiNote Stable
 */
public interface NexusHttpClient {
    List<RepoRecord> listComponents(String repository, boolean forceRefresh);
}

Experimental API:

/**
 * Experimental API - may change without notice.
 * Use at your own risk.
 * 
 * @since 2.1.0
 * @apiNote Experimental
 */
@Experimental
public interface AdvancedSearch {
    // May change in minor versions
}

2. Semantic Versioning Policy

Major version (X.0.0):

  • Breaking API changes
  • Interface signature changes
  • Removal of deprecated features
  • Minimum version bumps (Java, Android)

Minor version (X.Y.0):

  • New features (additive only)
  • New methods on interfaces (with defaults)
  • Performance improvements
  • New platforms

Patch version (X.Y.Z):

  • Bug fixes
  • Documentation updates
  • Security patches
  • No API changes

3. Deprecation Process

3-version deprecation:

// Version 2.0.0
public void oldMethod() {
    // Current implementation
}

// Version 2.1.0 - Add replacement
public void newMethod() {
    // Better implementation
}

@Deprecated(since = "2.1.0", forRemoval = true)
public void oldMethod() {
    // Delegate to new method
}

// Version 2.2.0 - Mark for removal
@Deprecated(since = "2.1.0", forRemoval = true)
public void oldMethod() {
    // Still works, but log warning
}

// Version 3.0.0 - Remove
// oldMethod() deleted

4. Compatibility Testing

Add API compatibility tests:

@Test
void testBackwardsCompatibility_v2_0_0() {
    // Code written against 2.0.0 should work with 2.x.x
    NexusHttpClient client = new NexusClient(credentials);
    List<RepoRecord> records = client.listComponents("repo", false);
    assertNotNull(records);
}

5. API Documentation

Create API compatibility guide:

docs/API_COMPATIBILITY.md:

# JNexus API Compatibility Policy

## Stability Guarantees

- **jnexus-core**: Stable API, backwards compatible within major version
- **Desktop UI classes**: Internal API, may change in any version
- **Android**: Follows Android semantic versioning
- **iOS**: Follows Swift semantic versioning

## Supported Versions

- Current major version: Full support
- Previous major version: Security patches only (6 months)
- Older versions: No support

## Upgrade Path

2.x.x → 3.0.0:
1. Upgrade to latest 2.x.x
2. Fix all deprecation warnings
3. Upgrade to 3.0.0

## Breaking Changes Log

### 3.0.0 (planned)
- Remove  (deprecated in 2.1.0)
- Require Java 21+ (currently Java 11+)

6. Version Annotations

Add custom annotations:

@Target({ElementType.TYPE, ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
@Documented
public @interface ApiStability {
    enum Level { STABLE, EXPERIMENTAL, INTERNAL, DEPRECATED }
    Level value();
    String since() default "";
}

Usage:

@ApiStability(ApiStability.Level.STABLE, since = "2.0.0")
public interface NexusHttpClient { ... }

@ApiStability(ApiStability.Level.EXPERIMENTAL, since = "2.1.0")
public interface BatchOperations { ... }

7. CHANGELOG Format

Clearly mark breaking changes:

## [3.0.0] - 2026-XX-XX

### BREAKING CHANGES
- ⚠️ Removed  (use  instead)
- ⚠️ Minimum Java version is now 21 (was 11)

### Added
- New  interface for bulk operations

### Migration Guide
See docs/MIGRATION_2.x_to_3.0.md

8. API Surface Documentation

Document public API surface:

# jnexus-core Public API

## Stable Interfaces
-  - HTTP client abstraction
-  - Credential provider
-  - Business logic (partial - ProgressCallback is experimental)

## Data Models (Stable)
- 
- 
- 
- 

## Internal (Not Stable)
- Desktop UI classes (JNexus, JNexusSwing, etc.)
- Test utilities

Benefits

  • Clear expectations for API consumers
  • Safer upgrades
  • Professional project management
  • Reduced breaking change impact
  • Better communication with users

Implementation Checklist

  • Create API_COMPATIBILITY.md
  • Add @ApiStability annotations
  • Document current API surface
  • Add compatibility tests
  • Update CONTRIBUTING.md with versioning policy
  • Create migration guides for future major versions

Priority

Medium - Improves professional appearance and user confidence

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions