raml

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2021 License: MPL-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Marshal

func Marshal(raml *Raml) ([]byte, error)

Types

type Documentation

type Documentation struct {
	// Title of the document.
	// Its value MUST be a non-empty string.
	Title string `yaml:"title"`
	// Content of the document.
	// Its value MUST be a non-empty string and MAY be formatted using markdown.
	Content string `yaml:"content"`
}
type Header struct {
	Description string `yaml:"description,omitempty"`
	Type        string `yaml:"type"`
}

type Property

type Property struct {
	Type string `yaml:"type"`
	// Specifies that the Property is required or not.
	Required bool `yaml:"required"`
}

type Raml

type Raml struct {
	// A short, plain-text label for the API.
	// Its value is a string.
	Title string `yaml:"title"`
	// A substantial, human-friendly description of the API.
	// Its value is a string and MAY be formatted using markdown.
	Description string `yaml:"description"`
	// The version of the API, for example "v1".
	// Its value is a string.
	Version string `yaml:"version"`
	// A URI that serves as the base for URIs of all resources.
	// Often used as the base of the URL of each resource containing the location of the API.
	// Can be a template URI.
	BaseUri string `yaml:"baseUri"`
	// The default media types to use for request and response bodies (payloads), for example "application/json".
	MediaType []string `yaml:"mediaType"`
	// Additional overall documentation for the API.
	Documentation []Documentation             `yaml:"documentation"`
	Types         map[string]Type             `yaml:"types"`
	Routes        map[string]map[string]Route `yaml:"-"`
}

The root section of the RAML document describes the basic information about an API, such as its title and version. The root section also defines assets used elsewhere in the RAML document, such as types and traits.

type Response

type Response struct {
	Body map[string]Type `yaml:"body"`
}

type Route

type Route struct {
	Headers     map[string]Header   `yaml:"headers,omitempty"`
	Body        map[string]Type     `yaml:"body,omitempty"`
	Responses   map[string]Response `yaml:"responses"`
	Description string              `yaml:"description,omitempty"`
}

type Type

type Type struct {
	// The type which the current type extends or just wraps.
	// The value of a type node MUST be either
	// a) the name of a user-defined type or
	// b) the name of a built-in RAML data type (object, array, or one of the scalar types)
	Type string `yaml:"type"`
	// An alternate, human-friendly name for the type
	DisplayName string `yaml:"displayName,omitempty"`
	// A substantial, human-friendly description of the type.
	// Its value is a string and MAY be formatted using markdown.
	Description string              `yaml:"description,omitempty"`
	Properties  map[string]Property `yaml:"properties,omitempty"`
}

Jump to

Keyboard shortcuts

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