Documentation
¶
Index ¶
- func CreateForgeDescriptor(router any, locationType farp.LocationType, locationConfig map[string]string) (*farp.SchemaDescriptor, error)
- type AsyncAPISchemaProvider
- type AsyncAPISpecProvider
- type ForgeProvider
- type Provider
- func (p *Provider) ContentType() string
- func (p *Provider) Endpoint() string
- func (p *Provider) Generate(ctx context.Context, app farp.Application) (any, error)
- func (p *Provider) GenerateDescriptor(ctx context.Context, app farp.Application, locationType farp.LocationType, ...) (*farp.SchemaDescriptor, error)
- func (p *Provider) Hash(schema any) (string, error)
- func (p *Provider) Serialize(schema any) ([]byte, error)
- func (p *Provider) SpecVersion() string
- func (p *Provider) Type() farp.SchemaType
- func (p *Provider) Validate(schema any) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateForgeDescriptor ¶
func CreateForgeDescriptor(router any, locationType farp.LocationType, locationConfig map[string]string) (*farp.SchemaDescriptor, error)
CreateForgeDescriptor creates a schema descriptor from a Forge router This is a helper method to simplify descriptor creation.
Types ¶
type AsyncAPISchemaProvider ¶
type AsyncAPISchemaProvider interface {
// AsyncAPISchema returns a base AsyncAPI schema (map[string]any) if the application provides one.
// The returned schema will be merged with the generated schema.
AsyncAPISchema() map[string]any
}
AsyncAPISchemaProvider is an optional interface that applications can implement to provide a base AsyncAPI schema that will be merged with the generated schema.
type AsyncAPISpecProvider ¶
type AsyncAPISpecProvider interface {
AsyncAPISpec() any
}
AsyncAPISpecProvider is an interface for types that can provide an AsyncAPI spec.
type ForgeProvider ¶
type ForgeProvider struct {
*Provider
}
ForgeProvider is a Forge-specific AsyncAPI provider that generates schemas from Forge's built-in AsyncAPI generator.
func NewForgeProvider ¶
func NewForgeProvider(specVersion string, endpoint string) *ForgeProvider
NewForgeProvider creates a new Forge-integrated AsyncAPI provider.
func (*ForgeProvider) Generate ¶
func (p *ForgeProvider) Generate(ctx context.Context, app farp.Application) (any, error)
Generate generates AsyncAPI schema from Forge application.
func (*ForgeProvider) GenerateFromRouter ¶
func (p *ForgeProvider) GenerateFromRouter(provider any) (any, error)
GenerateFromRouter generates AsyncAPI schema directly from any type that provides AsyncAPI specs This is a convenience method for direct router access.
func (*ForgeProvider) Validate ¶
func (p *ForgeProvider) Validate(schema any) error
Validate validates an AsyncAPI schema generated from Forge.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider generates AsyncAPI 2.x or 3.x schemas from applications.
func NewProvider ¶
NewProvider creates a new AsyncAPI schema provider specVersion should be "2.6.0" or "3.0.0" (recommended).
func (*Provider) ContentType ¶
ContentType returns the content type.
func (*Provider) Generate ¶
Generate generates an AsyncAPI schema from the application app should provide Routes() method that returns route information. If the app implements AsyncAPISchemaProvider, the provided schema will be merged with the generated one.
func (*Provider) GenerateDescriptor ¶
func (p *Provider) GenerateDescriptor(ctx context.Context, app farp.Application, locationType farp.LocationType, locationConfig map[string]string) (*farp.SchemaDescriptor, error)
GenerateDescriptor generates a complete SchemaDescriptor for this schema.
func (*Provider) SpecVersion ¶
SpecVersion returns the AsyncAPI specification version.