Documentation
¶
Index ¶
- func ValidateJSONSchema(schemaContent string, payload []byte) (*schema_pb.ValidationResult, error)
- type RedisRegistry
- func (r *RedisRegistry) Deactivate(ctx context.Context, schemaID string, version int32) error
- func (r *RedisRegistry) Get(ctx context.Context, schemaID string, version int32) (*schema_pb.Schema, error)
- func (r *RedisRegistry) GetLatest(ctx context.Context, schemaID string) (*schema_pb.Schema, error)
- func (r *RedisRegistry) IsCompatible(ctx context.Context, schemaID string, newContent string) (bool, error)
- func (r *RedisRegistry) List(ctx context.Context) ([]*schema_pb.Schema, error)
- func (r *RedisRegistry) Register(ctx context.Context, schema *schema_pb.Schema) (SchemaMetadata, error)
- func (r *RedisRegistry) Validate(ctx context.Context, schemaID string, version int32, payload []byte) (*schema_pb.ValidationResult, error)
- type Registry
- type SchemaMetadata
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ValidateJSONSchema ¶
func ValidateJSONSchema(schemaContent string, payload []byte) (*schema_pb.ValidationResult, error)
ValidateJSONSchema validates a JSON payload against a JSON Schema
Types ¶
type RedisRegistry ¶
type RedisRegistry struct {
// contains filtered or unexported fields
}
RedisRegistry implements Registry using Redis as the storage backend
func NewRedisRegistry ¶
func NewRedisRegistry(redisClient *redis.Client, logger *log.Logger) *RedisRegistry
NewRedisRegistry creates a new Redis-based schema registry
func (*RedisRegistry) Deactivate ¶
Deactivate marks a schema version as inactive
func (*RedisRegistry) Get ¶
func (r *RedisRegistry) Get(ctx context.Context, schemaID string, version int32) (*schema_pb.Schema, error)
Get retrieves a specific schema version
func (*RedisRegistry) IsCompatible ¶
func (r *RedisRegistry) IsCompatible(ctx context.Context, schemaID string, newContent string) (bool, error)
IsCompatible checks if a new schema content is compatible with existing versions
func (*RedisRegistry) Register ¶
func (r *RedisRegistry) Register(ctx context.Context, schema *schema_pb.Schema) (SchemaMetadata, error)
Register registers a new schema or creates a new version
type Registry ¶
type Registry interface {
// Register registers a new schema or updates an existing one
Register(ctx context.Context, schema *schema_pb.Schema) (SchemaMetadata, error)
// Get retrieves a specific schema version
Get(ctx context.Context, schemaID string, version int32) (*schema_pb.Schema, error)
// GetLatest retrieves the latest version of a schema
GetLatest(ctx context.Context, schemaID string) (*schema_pb.Schema, error)
// List lists all active schemas
List(ctx context.Context) ([]*schema_pb.Schema, error)
// Deactivate marks a schema version as inactive
Deactivate(ctx context.Context, schemaID string, version int32) error
// Validate validates a JSON payload against a schema
Validate(ctx context.Context, schemaID string, version int32, payload []byte) (*schema_pb.ValidationResult, error)
// IsCompatible checks if a new schema content is compatible with existing versions
IsCompatible(ctx context.Context, schemaID string, newContent string) (bool, error)
}
Registry manages message schemas
Click to show internal directories.
Click to hide internal directories.