Documentation
¶
Index ¶
- Constants
- func ContentReview01Contract() []byte
- func ContentReview02Contract() []byte
- func Decode[T any](reader io.Reader) (T, error)
- func Schema(name SchemaName) ([]byte, error)
- func ValidateDescription(value Description) error
- func ValidateProblem(value Problem) error
- func ValidateRequest(value Request) error
- func ValidateResult(value Result) error
- type Authorization
- type Description
- type Execution
- type Operation
- type Problem
- type Request
- type Result
- type SchemaName
- type Service
- type Target
- type TypeReference
Constants ¶
const ( Profile01 = "https://mailschema.org/profiles/map/0.1" Context01 = "https://mailschema.org/contexts/map-0.1.jsonld" ContentReviewType = "https://mailschema.org/types/content-review" )
Variables ¶
This section is empty.
Functions ¶
func ContentReview01Contract ¶ added in v0.1.1
func ContentReview01Contract() []byte
ContentReview01Contract returns an independent copy of the canonical type contract.
func ContentReview02Contract ¶ added in v0.1.1
func ContentReview02Contract() []byte
ContentReview02Contract returns an independent copy of the current canonical type contract.
func Decode ¶
Decode reads one strict JSON document. Unknown fields and trailing values are rejected.
func Schema ¶
func Schema(name SchemaName) ([]byte, error)
Schema returns an independent copy of a bundled JSON Schema document.
func ValidateDescription ¶
func ValidateDescription(value Description) error
ValidateDescription checks the fixed MAP 0.1 identifiers and core trust-relevant fields. Use the bundled JSON Schema for complete structural validation.
func ValidateProblem ¶ added in v0.1.1
ValidateProblem checks a MAP 0.1 problem's fixed identifiers and the required relationship between its code, type URI and HTTP status.
func ValidateRequest ¶
ValidateRequest checks a MAP 0.1 request's fixed identifiers and references. Type-specific input constraints remain in the type schema.
func ValidateResult ¶ added in v0.1.1
ValidateResult checks a MAP 0.1 result's fixed identifiers and references. Type-specific output constraints remain in the type schema.
Types ¶
type Authorization ¶
type Description ¶
type Description struct {
Context string `json:"@context"`
Kind string `json:"@type"`
ID string `json:"@id"`
Profile string `json:"profile"`
Type TypeReference `json:"type"`
DescribedAt time.Time `json:"describedAt"`
ExpiresAt time.Time `json:"expiresAt"`
Service Service `json:"service"`
Target Target `json:"target"`
Operations []Operation `json:"operations"`
}
type Problem ¶
type Problem struct {
Type string `json:"type"`
Title string `json:"title"`
Status int `json:"status"`
Detail string `json:"detail"`
Instance string `json:"instance,omitempty"`
Profile string `json:"profile,omitempty"`
RequestID string `json:"requestId,omitempty"`
InteractionID string `json:"interactionId,omitempty"`
Code string `json:"code,omitempty"`
Target *Target `json:"target,omitempty"`
}
type Result ¶
type Result struct {
Kind string `json:"kind"`
Profile string `json:"profile"`
RequestID string `json:"requestId"`
InteractionID string `json:"interactionId"`
Type TypeReference `json:"type"`
Operation string `json:"operation"`
State string `json:"state"`
Target Target `json:"target"`
RecordedAt time.Time `json:"recordedAt"`
ResultURL string `json:"resultUrl"`
Output map[string]any `json:"output"`
}
type SchemaName ¶
type SchemaName string
SchemaName identifies a schema bundled with this module.
const ( ContributionSchema SchemaName = "contribution" MAP01Schema SchemaName = "map-0.1" ContentReview01Schema SchemaName = "content-review-0.1" ContentReview02Schema SchemaName = "content-review-0.2" )
type Service ¶
type Service struct {
ID string `json:"id"`
Name string `json:"name"`
Execution Execution `json:"execution"`
HumanURL string `json:"humanUrl"`
Authorization Authorization `json:"authorization"`
}