Documentation
¶
Overview ¶
Package messageflow provides tools for visualizing AsyncAPI specifications. It enables parsing AsyncAPI documents and transforming them into visual format to help understand message flows and service interactions.
Index ¶
- Constants
- func NewUnsupportedFormatError(given, expected TargetType) error
- func NewUnsupportedFormatModeError(given FormatMode, expected []FormatMode) error
- type Action
- type Change
- type ChangeType
- type Changelog
- type Channel
- type FormatMode
- type FormatOptions
- type FormattedSchema
- type Message
- type Operation
- type Schema
- type SchemaExtractor
- type SchemaFormatter
- type SchemaRenderer
- type Service
- type Source
- type Target
- type TargetCapabilities
- type TargetType
- type UnsupportedFormatError
- type UnsupportedFormatModeError
Constants ¶
const ( FormatModeContextServices = FormatMode("context_services") FormatModeServiceChannels = FormatMode("service_channels") FormatModeChannelServices = FormatMode("channel_services") FormatModeServiceServices = FormatMode("service_services") )
Variables ¶
This section is empty.
Functions ¶
func NewUnsupportedFormatError ¶
func NewUnsupportedFormatError(given, expected TargetType) error
NewUnsupportedFormatError creates a new UnsupportedFormatError.
func NewUnsupportedFormatModeError ¶
func NewUnsupportedFormatModeError(given FormatMode, expected []FormatMode) error
NewUnsupportedFormatModeError creates a new UnsupportedFormatModeError.
Types ¶
type Action ¶
type Action string
Action represents the type of operation that can be performed on a channel.
type Change ¶
type Change struct { Type ChangeType `json:"type"` Category string `json:"category"` Name string `json:"name"` Details string `json:"details,omitempty"` Diff string `json:"diff,omitempty"` Timestamp time.Time `json:"timestamp"` }
Change represents a single change in the schema.
type ChangeType ¶
type ChangeType string
ChangeType represents the type of change that occurred.
const ( ChangeTypeAdded ChangeType = "added" ChangeTypeRemoved ChangeType = "removed" ChangeTypeChanged ChangeType = "changed" )
type Changelog ¶
Changelog represents a collection of changes with a version and date.
func CompareSchemas ¶
CompareSchemas compares two schemas and returns a changelog of differences.
type FormatOptions ¶
type FormatOptions struct { Mode FormatMode Service string Channel string OmitPayloads bool }
type FormattedSchema ¶
type FormattedSchema struct { Type TargetType `json:"type"` Data []byte `json:"data"` }
FormattedSchema represents a schema that has been formatted for a specific target type.
type Operation ¶
type Operation struct { Action Action `json:"action"` Channel Channel `json:"channel"` Reply *Channel `json:"reply,omitempty"` }
Operation defines an action to be performed on a channel, optionally with a reply channel.
type Schema ¶
type Schema struct {
Services []Service `json:"services"`
}
Schema defines the structure of a message flow schema containing services and their operations.
func MergeSchemas ¶
MergeSchemas combines multiple Schema objects into a single Schema.
type SchemaExtractor ¶
SchemaExtractor interface defines the contract for extracting schemas.
type SchemaFormatter ¶
type SchemaFormatter interface {
FormatSchema(ctx context.Context, s Schema, opts FormatOptions) (FormattedSchema, error)
}
SchemaFormatter interface defines the contract for formatting schemas.
type SchemaRenderer ¶
type SchemaRenderer interface {
RenderSchema(ctx context.Context, fs FormattedSchema) ([]byte, error)
}
SchemaRenderer interface defines the contract for rendering formatted schemas.
type Service ¶
type Service struct { Name string `json:"name"` Description string `json:"description,omitempty"` Operation []Operation `json:"operations"` }
Service represents a service in the message flow with its name and operations.
type Source ¶
type Source interface { SchemaExtractor }
Source interface defines the contract for schema extraction.
type Target ¶
type Target interface { SchemaFormatter SchemaRenderer Capabilities() TargetCapabilities }
Target interface defines the contract for schema formatting and rendering.
type TargetCapabilities ¶
TargetCapabilities represents the capabilities of a Target implementation.
type TargetType ¶
type TargetType string
TargetType represents the type of target format for schema conversion.
type UnsupportedFormatError ¶
type UnsupportedFormatError struct {
// contains filtered or unexported fields
}
UnsupportedFormatError represents an error when an unsupported format is provided.
func (*UnsupportedFormatError) Error ¶
func (err *UnsupportedFormatError) Error() string
Error implements the error interface for UnsupportedFormatError.
type UnsupportedFormatModeError ¶
type UnsupportedFormatModeError struct {
// contains filtered or unexported fields
}
UnsupportedFormatModeError represents an error when an unsupported format mode is provided.
func (*UnsupportedFormatModeError) Error ¶
func (err *UnsupportedFormatModeError) Error() string
Error implements the error interface for UnsupportedFormatError.
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
messageflow
command
|
|
internal
|
|
pkg
|
|
schema/source/asyncapi
Package asyncapi provides functionality for extracting message flow schemas from AsyncAPI specifications.
|
Package asyncapi provides functionality for extracting message flow schemas from AsyncAPI specifications. |
schema/target/d2
Package d2 provides functionality for generating and rendering D2 diagrams.
|
Package d2 provides functionality for generating and rendering D2 diagrams. |