design

package
v0.0.0-...-b3b36fe Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2018 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Overview

Package design holds a goa design (https://goa.design/) which specifies the OCG REST-API. The goagen tool is used to generate different sources like the application logic, controllers and swagger files. Execute the goagen commands from project root every time the design changes! $ goagen app -d github.com/aweisser/ocg-poc/io/rest/design -o io/rest/ $ goagen controller -d github.com/aweisser/ocg-poc/io/rest/design -o io/rest/controller/ --app-pkg github.com/aweisser/ocg-poc/io/rest/app $ goagen swagger -d github.com/aweisser/ocg-poc/io/rest/design -o io/rest/

Index

Constants

This section is empty.

Variables

View Source
var JSONAPIError = a.Type("JSONAPIError", func() {
	a.Description(`Error objects provide additional information about problems encountered while
performing an operation. Error objects MUST be returned as an array keyed by errors in the
top level of a JSON API document.

See. also http://jsonapi.org/format/#error-objects.`)

	a.Attribute("id", d.String, "a unique identifier for this particular occurrence of the problem.")
	a.Attribute("links", a.HashOf(d.String, JSONAPILink), `a links object containing the following members:
* about: a link that leads to further details about this particular occurrence of the problem.`)
	a.Attribute("status", d.String, "the HTTP status code applicable to this problem, expressed as a string value.")
	a.Attribute("code", d.String, "an application-specific error code, expressed as a string value.")
	a.Attribute("title", d.String, `a short, human-readable summary of the problem that SHOULD NOT
change from occurrence to occurrence of the problem, except for purposes of localization.`)
	a.Attribute("detail", d.String, `a human-readable explanation specific to this occurrence of the problem.
Like title, this field’s value can be localized.`)
	a.Attribute("source", a.HashOf(d.String, d.Any), `an object containing references to the source of the error,
optionally including any of the following members

* pointer: a JSON Pointer [RFC6901] to the associated entity in the request document [e.g. "/data" for a primary data object,
           or "/data/attributes/title" for a specific attribute].
* parameter: a string indicating which URI query parameter caused the error.`)
	a.Attribute("meta", a.HashOf(d.String, d.Any), "a meta object containing non-standard meta-information about the error")

	a.Required("detail")
})

JSONAPIError represents a JSONAPI error object (see http://jsonapi.org/format/#error-objects)

View Source
var JSONAPIErrors = a.MediaType("application/vnd.jsonapierrors+json", func() {
	a.UseTrait("jsonapi-media-type")
	a.TypeName("JSONAPIErrors")
	a.Description(``)
	a.Attributes(func() {
		a.Attribute("errors", a.ArrayOf(JSONAPIError))
		a.Required("errors")
	})
	a.View("default", func() {
		a.Attribute("errors")
		a.Required("errors")
	})
})

JSONAPIErrors is an array of JSONAPI error objects

View Source
var JSONAPILink = a.Type("JSONAPILink", func() {
	a.Description(`See also http://jsonapi.org/format/#document-links.`)
	a.Attribute("href", d.String, "a string containing the link's URL.", func() {
		a.Example("http://example.com/articles/1/comments")
	})
	a.Attribute("meta", a.HashOf(d.String, d.Any), "a meta object containing non-standard meta-information about the link.")
})

JSONAPILink represents a JSONAPI link object (see http://jsonapi.org/format/#document-links)

Functions

func JSONList

func JSONList(name, description string, data *d.UserTypeDefinition, meta *d.UserTypeDefinition) *d.MediaTypeDefinition

JSONList creates a UserTypeDefinition

func JSONResourceObject

func JSONResourceObject(name string, attributes *d.UserTypeDefinition, relationships *d.UserTypeDefinition) *d.UserTypeDefinition

JSONResourceObject creates a single resource object

func JSONSingle

func JSONSingle(name, description string, data *d.UserTypeDefinition, links *d.UserTypeDefinition) *d.MediaTypeDefinition

JSONSingle creates a Single

Types

This section is empty.

Jump to

Keyboard shortcuts

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