jsonapi

package
v0.1.13 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2026 License: AGPL-3.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorCaller

type ErrorCaller struct {
	File     string `json:"file,omitempty"`
	Line     int64  `json:"line,omitempty"`
	Function string `json:"function,omitempty"`
}

func (*ErrorCaller) GetFile

func (e *ErrorCaller) GetFile() string

func (*ErrorCaller) GetFunction

func (e *ErrorCaller) GetFunction() string

func (*ErrorCaller) GetLine

func (e *ErrorCaller) GetLine() int64

type ErrorObject

type ErrorObject struct {
	// a unique identifier for this particular occurrence of the problem.
	ID string `json:"id,omitempty"`
	// a links object containing references to the source of the error.
	Links mo.Option[*Links] `json:"links"`
	// the HTTP status code applicable to this problem, expressed as a string value.
	Status int `json:"status,omitempty"`
	// an application-specific error code, expressed as a string value.
	Code string `json:"code,omitempty"`
	// a short, human-readable summary of the problem
	Title string `json:"title,omitempty"`
	// a human-readable explanation specific to this occurrence of the problem. Like title.
	Detail string `json:"detail,omitempty"`
	// an object containing references to the source of the error.
	Source mo.Option[ErrorObjectSource] `json:"source"`
	// a meta object containing non-standard meta-information about the error.
	Meta mo.Option[map[string]any] `json:"meta"`
}

ErrorObject

JSON API spec error object Documentation: https://jsonapi.org/format/#error-objects

type ErrorObjectSource

type ErrorObjectSource struct {
	// a JSON Pointer [RFC6901] to the value in the request document that caused the error
	// [e.g. "/data" for a primary data object, or "/data/attributes/title" for a specific attribute].
	Pointer string `json:"pointer,omitempty"`
	// a string indicating which URI query parameter caused the error.
	Parameter string `json:"parameter,omitempty"`
	// a string indicating the name of a single request header which caused the error.
	Header string `json:"header,omitempty"`
}
type Links struct {
	// a string whose value is a URI-reference [RFC3986 Section 4.1] pointing to the link’s target.
	Href string `json:"href,omitempty"`
	// a string indicating the link’s relation type.
	Rel mo.Option[string] `json:"rel"`
	// a link to a description document (e.g. OpenAPI or JSON Schema) for the link target.
	Describedby mo.Option[string] `json:"describedby"`
	// a string which serves as a label for the destination of a link
	// such that it can be used as a human-readable identifier (e.g., a menu entry).
	Title mo.Option[string] `json:"title"`
	// a string indicating the media type of the link’s target.
	Type mo.Option[string] `json:"type"`
	// a string or an array of strings indicating the language(s) of the link’s target.
	// An array of strings indicates that the link’s target is available in multiple languages.
	Hreflang mo.Option[string] `json:"hreflang"`
	// a meta object containing non-standard meta-information about the link.
	Meta mo.Option[map[string]any] `json:"meta"`
}

type Response

type Response struct {
	// Data is the primary data for a response.
	Data []any `protobuf:"bytes,1,rep,name=data,proto3" json:"data,omitempty"`
	// Errors is an array of error objects.
	Errors []*ErrorObject `protobuf:"bytes,2,rep,name=errors,proto3" json:"errors,omitempty"`
}

Jump to

Keyboard shortcuts

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