path

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 30, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Get     = Verb("get")
	Put     = Verb("put")
	Post    = Verb("post")
	Delete  = Verb("delete")
	Options = Verb("options")
	Patch   = Verb("patch")
	Head    = Verb("head")
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Implementation

type Implementation struct {
	Summary     string
	Description *string
	Path        string
	PerVerb     map[Verb]VerbImplementation
}

User-provided metadata containing information on the implementation to be converted to OpenAPI spec (all verbs at one path).

type Route

type Route string

A path in the API.

MUST start with `/`. Path templating is allowed.

func MakeRoute

func MakeRoute(path string) (Route, error)

type Spec

type Spec struct {
	// Short summary for all operations on this path.
	Summary string `json:"summary,omitempty"`

	// Longer description for all operations on this path. May include Markdown.
	Description *string `json:"description,omitempty"`

	// A list of parameters that are applicable for all the operations described under this path. These parameters can be overridden at the operation level, but cannot be removed there. The list MUST NOT include duplicated parameters. A unique parameter is defined by a combination of a name and location. The list can use the Reference Object to link to parameters that are defined in the OpenAPI Object’s components.parameters.
	//
	// In the current implementation, we expect that this contains the path parameters.
	Parameters *[]parameter.Parameter `json:"parameters,omitempty"`

	Get     *operation.Spec `json:"get,omitempty"`
	Put     *operation.Spec `json:"put,omitempty"`
	Post    *operation.Spec `json:"post,omitempty"`
	Delete  *operation.Spec `json:"delete,omitempty"`
	Options *operation.Spec `json:"options,omitempty"`
	Patch   *operation.Spec `json:"patch,omitempty"`
}

Specifications for one path (all verbs).

func FromPath

func FromPath(impl Implementation) (Spec, error)

type Verb

type Verb string

The HTTP verbs.

type VerbImplementation

type VerbImplementation struct {
	// The type of inputs.
	//
	// This must be either the zero value (no input) or a struct containing
	// no other field than `Body`, `Query`, `Path`, `Header`.
	Input reflect.Type

	// Security requirements for this endpoint.
	Security []security.Requirement

	// A human-readable summary explaining what this endpoint does.
	Summary string

	// A more detailed description. May contain markdown.
	Description *string

	// Reference to external documentation.
	ExternalDocs *doc.External

	// Information on the response.
	Response response.Implementation

	// If `true`, mark this endpoint as deprecated.
	Deprecated bool
}

User-provided metadata containing information on the implementation to be converted to OpenAPI spec (a single verb at one path).

Jump to

Keyboard shortcuts

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