Documentation
¶
Index ¶
- func ValidateJSONSchema(schemaContent string, payload []byte) (*schema_pb.ValidationResult, error)
- type PostgresRegistry
- func (r *PostgresRegistry) Deactivate(ctx context.Context, schemaID string, version int32) error
- func (r *PostgresRegistry) Get(ctx context.Context, schemaID string, version int32) (*schema_pb.Schema, error)
- func (r *PostgresRegistry) GetLatest(ctx context.Context, schemaID string) (*schema_pb.Schema, error)
- func (r *PostgresRegistry) IsCompatible(ctx context.Context, schemaID string, newContent string) (bool, error)
- func (r *PostgresRegistry) List(ctx context.Context) ([]*schema_pb.Schema, error)
- func (r *PostgresRegistry) Register(ctx context.Context, schema *schema_pb.Schema) (SchemaMetadata, error)
- func (r *PostgresRegistry) 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 PostgresRegistry ¶ added in v1.2.0
type PostgresRegistry struct {
// contains filtered or unexported fields
}
PostgresRegistry implements Registry using PostgreSQL as the storage backend.
func NewPostgresRegistry ¶ added in v1.2.0
NewPostgresRegistry creates a new PostgreSQL-based schema registry.
func (*PostgresRegistry) Deactivate ¶ added in v1.2.0
Deactivate marks a schema version as inactive.
func (*PostgresRegistry) Get ¶ added in v1.2.0
func (r *PostgresRegistry) Get(ctx context.Context, schemaID string, version int32) (*schema_pb.Schema, error)
Get retrieves a specific schema version.
func (*PostgresRegistry) GetLatest ¶ added in v1.2.0
func (r *PostgresRegistry) GetLatest(ctx context.Context, schemaID string) (*schema_pb.Schema, error)
GetLatest retrieves the latest version of a schema.
func (*PostgresRegistry) IsCompatible ¶ added in v1.2.0
func (r *PostgresRegistry) IsCompatible(ctx context.Context, schemaID string, newContent string) (bool, error)
IsCompatible checks if a new schema content is compatible with existing versions.
func (*PostgresRegistry) List ¶ added in v1.2.0
List lists all active schemas (latest version of each).
func (*PostgresRegistry) Register ¶ added in v1.2.0
func (r *PostgresRegistry) 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.