swagger

package
v1.1.371 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2019 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Overrides is keyed on url
	Overrides map[string]PathOverride
	// AdditionalGetPaths contains extra paths to include as GET
	AdditionalGetPaths []string
	// SuppressAPIVersion true to prevent the api version querystring
	SuppressAPIVersion bool
}

Config handles configuration of url handling

type Path

type Path struct {
	Name                  string
	CondensedEndpointPath string
	Endpoint              *endpoints.EndpointInfo // The logical endpoint. May be overridden for an operation
	Operations            PathOperations
	Children              []*Path
	SubPaths              []*Path
}

Path represents a path that we want to consider emitting in code-gen. It is derived from

func MergeSwaggerDoc

func MergeSwaggerDoc(paths []*Path, config *Config, doc *loads.Document, validateCapturedSegments bool) ([]*Path, error)

MergeSwaggerDoc merges api endpoints from the specified swagger doc into the Paths array

type PathAndNameStrippedPath

type PathAndNameStrippedPath struct {
	Path             string
	NameStrippedPath string
}

PathAndNameStrippedPath holds a full path and the path with names stripped out. E.g. for `/foo/{wibble}/bar` the stripped path is `/foo/{}/bar`

func (PathAndNameStrippedPath) GetValue

func (p PathAndNameStrippedPath) GetValue(strippedPath bool) string

GetValue is a small helper to get the path value as determined by the `strippedPath` parameter

type PathAndNameStrippedPathList

type PathAndNameStrippedPathList []PathAndNameStrippedPath

PathAndNameStrippedPathList is allows sorting PathAndNameStrippedPath array by NameStrippedPath

func (PathAndNameStrippedPathList) Len

func (PathAndNameStrippedPathList) Less

func (a PathAndNameStrippedPathList) Less(i, j int) bool

func (PathAndNameStrippedPathList) Swap

func (a PathAndNameStrippedPathList) Swap(i, j int)

type PathOperation

type PathOperation struct {
	Permitted bool                    // true if the operation is permitted for the path
	Verb      string                  // Empty unless the Verb is overridden for the operation
	Endpoint  *endpoints.EndpointInfo // nil unless the endpoint is overridden for the operation
}

PathOperation represents an operation on the path (GET, PUT, ...)

type PathOperations

type PathOperations struct {
	Get    PathOperation
	Delete PathOperation
	Patch  PathOperation
	Post   PathOperation
	Put    PathOperation
}

PathOperations gives details on the operations for a resource

type PathOverride

type PathOverride struct {
	Path    string // actual url to use
	GetVerb string // Verb to use for logical GET requests
}

PathOverride captures Path and/or Verb overrides

type ResourceType

type ResourceType struct {
	Display        string
	Endpoint       *endpoints.EndpointInfo
	Verb           string
	DeleteEndpoint *endpoints.EndpointInfo
	PatchEndpoint  *endpoints.EndpointInfo
	PutEndpoint    *endpoints.EndpointInfo
	Children       []ResourceType // Children are auto-loaded (must be able to build the URL => no additional template URL values)
	SubResources   []ResourceType // SubResources are not auto-loaded (these come from the request to the endpoint)
}

ResourceType holds information about resources that can be displayed

func ConvertToSwaggerResourceTypes

func ConvertToSwaggerResourceTypes(paths []*Path) []ResourceType

ConvertToSwaggerResourceTypes converts the Path array to an array of SwaggerResourceTypes for use with the Swagger expander

Jump to

Keyboard shortcuts

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