Skip to content

v0.0.3 - Partial Implementation Feature

Latest

Choose a tag to compare

@khunfloat khunfloat released this 04 Dec 01:21

Note: v0.0.2 is deprecated

This release introduces important improvements to IRPC’s contract system, enabling better flexibility and stronger validation during service registration.
The overall API remains backward-compatible.

🚀 New Features

1. Partial Contract Support (AllowPartial)

IRPC now supports registering contracts that only implement some of the interface methods.

registry := irpc.NewRegistry(irpc.Config{
    AllowPartial: true,
})

When enabled:

  • Missing interface methods are silently skipped
  • Existing registered methods continue to work
  • Useful for incremental development, mocks, and plugin systems

Default behavior remains strict (panic on missing methods).

2. Contract Implementation Validation (ValidateImpl)

Added a new API:

func (r *Registry) ValidateImpl(serviceName string, iface any)

This method verifies that a contract is already successfully implemented.
If any method is missing, the registry panics with a detailed message:

irpc: irpc: missing registered handler for ...

Ideal for startup validation and test helpers.

🛠 Improvements

  • Updated internal Registry logic to better support partial implementation and method introspection
  • README updated with complete examples, contract flow, and client usage
  • More explicit behavior documentation for override and partial modes

⚙️ Breaking Changes

None.

All existing applications using IRPC v0.0.1 will continue working without modification.

📦 Upgrading

Update using:

go get github.com/khunfloat/irpc@latest

If you want strict contract enforcement (old behavior), no config changes are required.
If you want partial support, set:

AllowPartial: true