transportir

package
v1.12.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 5 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	// ResponseContractSuccess identifies a successful response.
	ResponseContractSuccess ResponseContractCaseKind = "success"
	// ResponseContractError identifies a service error.
	ResponseContractError ResponseContractCaseKind = "error"

	// ResponseContractMissingEndpoint indicates that no endpoint was supplied.
	ResponseContractMissingEndpoint ResponseContractLimitationCode = "missing_endpoint"
	// ResponseContractMissingIdentity indicates that service or method identity is unavailable.
	ResponseContractMissingIdentity ResponseContractLimitationCode = "missing_identity"
	// ResponseContractMissingResponse indicates that response metadata is unavailable.
	ResponseContractMissingResponse ResponseContractLimitationCode = "missing_response"
	// ResponseContractStreaming indicates an unsupported stream lifecycle.
	ResponseContractStreaming ResponseContractLimitationCode = "streaming"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Name         string
	Description  string
	Method       *expr.MethodExpr
	Service      *Service
	Requirements []*expr.SecurityExpr
	Request      *Request
	Response     *Response
	Errors       []*Error
	Stream       *Stream
}

func BuildEndpoint

func BuildEndpoint(service *Service, endpoint *expr.GRPCEndpointExpr) *Endpoint

type Error

type Error struct {
	Name      string
	Type      expr.DataType
	Attribute *expr.AttributeExpr
	Response  *Response
}

type Request

type Request struct {
	Payload             *expr.AttributeExpr
	Message             *expr.AttributeExpr
	ProtoMessage        *expr.AttributeExpr
	StreamingPayload    *expr.AttributeExpr
	StreamingMessage    *expr.AttributeExpr
	ProtoStreamingInput *expr.AttributeExpr
	// ProtoStreamEnvelope is the synthesized envelope message that
	// carries both the one-shot payload and streaming payload items
	// through a single gRPC stream when a method declares both
	// Payload(...) and StreamingPayload(...).
	ProtoStreamEnvelope *expr.AttributeExpr
	Metadata            *expr.MappedAttributeExpr
}

type Response

type Response struct {
	Result       *expr.AttributeExpr
	Message      *expr.AttributeExpr
	ProtoMessage *expr.AttributeExpr
	StatusCode   int
	Description  string
	Headers      *expr.MappedAttributeExpr
	Trailers     *expr.MappedAttributeExpr
}

type ResponseContractAnalysis added in v1.8.0

type ResponseContractAnalysis struct {
	// Cases lists response branches in design order.
	Cases []*ResponseContractCase
	// Limitations explains why cases could not be produced.
	Limitations []ResponseContractLimitation
}

ResponseContractAnalysis contains supported cases or explicit limitations.

func AnalyzeResponseContractCases added in v1.8.0

func AnalyzeResponseContractCases(endpoint *Endpoint) *ResponseContractAnalysis

AnalyzeResponseContractCases builds deterministic gRPC response cases.

func (*ResponseContractAnalysis) Supported added in v1.8.0

func (a *ResponseContractAnalysis) Supported() bool

Supported reports whether cases were produced without limitations.

type ResponseContractCase added in v1.8.0

type ResponseContractCase struct {
	// ID is stable while the service contract is unchanged.
	ID string
	// Kind identifies a successful result or service error.
	Kind ResponseContractCaseKind
	// StatusCode is the declared gRPC status code.
	StatusCode int
	// MessageType is the protobuf response message name.
	MessageType string
	// ErrorName is the declared service error name.
	ErrorName string
	// DetailType is the protobuf status detail message name.
	DetailType string
	// RequiredHeaders lists required response metadata keys.
	RequiredHeaders []string
	// RequiredTrailers lists required trailer metadata keys.
	RequiredTrailers []string
	// Stream describes a supported streaming completion.
	Stream *ResponseContractStream
}

ResponseContractCase describes one declared gRPC response branch.

type ResponseContractCaseKind added in v1.8.0

type ResponseContractCaseKind string

ResponseContractCaseKind identifies a successful result or service error.

type ResponseContractLimitation added in v1.8.0

type ResponseContractLimitation struct {
	// Code identifies the unsupported feature.
	Code ResponseContractLimitationCode
	// Detail explains the limitation.
	Detail string
}

ResponseContractLimitation explains an unsupported endpoint shape.

type ResponseContractLimitationCode added in v1.8.0

type ResponseContractLimitationCode string

ResponseContractLimitationCode identifies an unsupported endpoint shape.

type ResponseContractStream added in v1.8.0

type ResponseContractStream struct {
	// Direction is the designed stream direction.
	Direction string
	// Terminal identifies the expected completion behavior.
	Terminal string
}

ResponseContractStream describes a selected gRPC stream completion.

type Service

type Service struct {
	Name        string
	Description string
	Expr        *expr.GRPCServiceExpr
	Endpoints   []*Endpoint
}

func BuildService

func BuildService(svc *expr.GRPCServiceExpr) *Service

type Stream

type Stream struct {
	IsStreaming        bool
	IsPayloadStreaming bool
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL