Documentation
¶
Index ¶
Constants ¶
View Source
const ( // ResponseContractSuccess identifies a successful response. ResponseContractSuccess ResponseContractCaseKind = "success" // ResponseContractError identifies a service error. ResponseContractError ResponseContractCaseKind = "error" // ResponseContractNotification identifies response suppression for an ID-less request. ResponseContractNotification ResponseContractCaseKind = "notification" // ResponseContractMissingEndpoint indicates that no endpoint was supplied. ResponseContractMissingEndpoint ResponseContractLimitationCode = "missing_endpoint" // ResponseContractMissingIdentity indicates that service or method identity is unavailable. ResponseContractMissingIdentity ResponseContractLimitationCode = "missing_identity" // ResponseContractNotJSONRPC indicates that the endpoint is not JSON-RPC. ResponseContractNotJSONRPC ResponseContractLimitationCode = "not_jsonrpc" // ResponseContractStreaming indicates an unsupported stream lifecycle. ResponseContractStreaming ResponseContractLimitationCode = "streaming" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ResponseContractAnalysis ¶
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 ¶
func AnalyzeResponseContractCases(endpoint *expr.HTTPEndpointExpr) *ResponseContractAnalysis
AnalyzeResponseContractCases builds deterministic JSON-RPC response cases.
func (*ResponseContractAnalysis) Supported ¶
func (a *ResponseContractAnalysis) Supported() bool
Supported reports whether cases were produced without limitations.
type ResponseContractCase ¶
type ResponseContractCase struct {
// ID is stable while the service contract is unchanged.
ID string
// Kind identifies a success, service error, or notification.
Kind ResponseContractCaseKind
// ResultType is the designed success result type.
ResultType string
// HasResult reports whether a success envelope contains a result member.
HasResult bool
// ErrorCode is the declared JSON-RPC error code.
ErrorCode int
// ErrorName is the declared service error name.
ErrorName string
// ErrorDataType is the designed JSON error-data type.
ErrorDataType string
// Stream describes a supported streaming terminal contract.
Stream *ResponseContractStream
}
ResponseContractCase describes one declared JSON-RPC response branch.
type ResponseContractCaseKind ¶
type ResponseContractCaseKind string
ResponseContractCaseKind identifies a JSON-RPC response branch.
type ResponseContractLimitation ¶
type ResponseContractLimitation struct {
// Code identifies the unsupported feature.
Code ResponseContractLimitationCode
// Detail explains the limitation.
Detail string
}
ResponseContractLimitation explains an unsupported endpoint shape.
type ResponseContractLimitationCode ¶
type ResponseContractLimitationCode string
ResponseContractLimitationCode identifies an unsupported endpoint shape.
type ResponseContractStream ¶
type ResponseContractStream struct {
// Transport identifies the streaming wire protocol.
Transport string
// Terminal identifies the expected terminal behavior.
Terminal string
}
ResponseContractStream describes a selected JSON-RPC stream terminal.
Click to show internal directories.
Click to hide internal directories.