Documentation
¶
Index ¶
- type ORPCSchemaProvider
- 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) SetEndpoint(endpoint string)
- 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 ¶
This section is empty.
Types ¶
type ORPCSchemaProvider ¶
type ORPCSchemaProvider interface {
// ORPCSchema returns a base oRPC schema (map[string]any) if the application provides one.
// The returned schema will be merged with the generated schema.
ORPCSchema() map[string]any
}
ORPCSchemaProvider is an optional interface that applications can implement to provide a base oRPC schema that will be merged with the generated schema.
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider generates oRPC (OpenAPI-based RPC) schemas from applications oRPC is similar to OpenAPI but optimized for RPC-style calls.
func NewProvider ¶
NewProvider creates a new oRPC schema provider specVersion should be the oRPC specification version (e.g., "1.0.0").
func (*Provider) ContentType ¶
ContentType returns the content type.
func (*Provider) Generate ¶
Generate generates an oRPC schema from the application. If the app implements ORPCSchemaProvider, 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) SetEndpoint ¶
SetEndpoint sets the HTTP endpoint for the oRPC schema.
func (*Provider) SpecVersion ¶
SpecVersion returns the oRPC specification version.