swag: github.com/go-openapi/swag Index | Files

package swag

import "github.com/go-openapi/swag"

Index

Package Files

convert.go convert_types.go json.go loading.go net.go path.go util.go yaml.go

Constants

const (
    // GOPATHKey represents the env key for gopath
    GOPATHKey = "GOPATH"
)

Variables

var DefaultJSONNameProvider = NewNameProvider()

DefaultJSONNameProvider the default cache for types

var LoadHTTPTimeout = 30 * time.Second

LoadHTTPTimeout the default timeout for load requests

func Bool Uses

func Bool(v bool) *bool

Bool returns a pointer to of the bool value passed in.

func BoolMap Uses

func BoolMap(src map[string]bool) map[string]*bool

BoolMap converts a string map of bool values into a string map of bool pointers

func BoolSlice Uses

func BoolSlice(src []bool) []*bool

BoolSlice converts a slice of bool values into a slice of bool pointers

func BoolValue Uses

func BoolValue(v *bool) bool

BoolValue returns the value of the bool pointer passed in or false if the pointer is nil.

func BoolValueMap Uses

func BoolValueMap(src map[string]*bool) map[string]bool

BoolValueMap converts a string map of bool pointers into a string map of bool values

func BoolValueSlice Uses

func BoolValueSlice(src []*bool) []bool

BoolValueSlice converts a slice of bool pointers into a slice of bool values

func BytesToYAMLDoc Uses

func BytesToYAMLDoc(data []byte) (interface{}, error)

func ConcatJSON Uses

func ConcatJSON(blobs ...[]byte) []byte

ConcatJSON concatenates multiple json objects efficiently

func ContainsStringsCI Uses

func ContainsStringsCI(coll []string, item string) bool

ContainsStringsCI searches a slice of strings for a case-insensitive match

func ConvertBool Uses

func ConvertBool(str string) (bool, error)

ConvertBool turn a string into a boolean

func ConvertFloat32 Uses

func ConvertFloat32(str string) (float32, error)

ConvertFloat32 turn a string into a float32

func ConvertFloat64 Uses

func ConvertFloat64(str string) (float64, error)

ConvertFloat64 turn a string into a float64

func ConvertInt16 Uses

func ConvertInt16(str string) (int16, error)

ConvertInt16 turn a string into a int16

func ConvertInt32 Uses

func ConvertInt32(str string) (int32, error)

ConvertInt32 turn a string into a int32

func ConvertInt64 Uses

func ConvertInt64(str string) (int64, error)

ConvertInt64 turn a string into a int64

func ConvertInt8 Uses

func ConvertInt8(str string) (int8, error)

ConvertInt8 turn a string into int8 boolean

func ConvertUint16 Uses

func ConvertUint16(str string) (uint16, error)

ConvertUint16 turn a string into a uint16

func ConvertUint32 Uses

func ConvertUint32(str string) (uint32, error)

ConvertUint32 turn a string into a uint32

func ConvertUint64 Uses

func ConvertUint64(str string) (uint64, error)

ConvertUint64 turn a string into a uint64

func ConvertUint8 Uses

func ConvertUint8(str string) (uint8, error)

ConvertUint8 turn a string into a uint8

func DynamicJSONToStruct Uses

func DynamicJSONToStruct(data interface{}, target interface{}) error

DynamicJSONToStruct converts an untyped json structure into a struct

func FindInGoSearchPath Uses

func FindInGoSearchPath(pkg string) string

FindInGoSearchPath finds a package in the $GOPATH:$GOROOT

func FindInSearchPath Uses

func FindInSearchPath(searchPath, pkg string) string

FindInSearchPath finds a package in a provided lists of paths

func Float64 Uses

func Float64(v float64) *float64

Float64 returns a pointer to of the float64 value passed in.

func Float64Map Uses

func Float64Map(src map[string]float64) map[string]*float64

Float64Map converts a string map of float64 values into a string map of float64 pointers

func Float64Slice Uses

func Float64Slice(src []float64) []*float64

Float64Slice converts a slice of float64 values into a slice of float64 pointers

func Float64Value Uses

func Float64Value(v *float64) float64

Float64Value returns the value of the float64 pointer passed in or 0 if the pointer is nil.

func Float64ValueMap Uses

func Float64ValueMap(src map[string]*float64) map[string]float64

Float64ValueMap converts a string map of float64 pointers into a string map of float64 values

func Float64ValueSlice Uses

func Float64ValueSlice(src []*float64) []float64

Float64ValueSlice converts a slice of float64 pointers into a slice of float64 values

func FormatBool Uses

func FormatBool(value bool) string

FormatBool turns a boolean into a string

func FormatFloat32 Uses

func FormatFloat32(value float32) string

FormatFloat32 turns a float32 into a string

func FormatFloat64 Uses

func FormatFloat64(value float64) string

FormatFloat64 turns a float64 into a string

func FormatInt16 Uses

func FormatInt16(value int16) string

FormatInt16 turns an int16 into a string

func FormatInt32 Uses

func FormatInt32(value int32) string

FormatInt32 turns an int32 into a string

func FormatInt64 Uses

func FormatInt64(value int64) string

FormatInt64 turns an int64 into a string

func FormatInt8 Uses

func FormatInt8(value int8) string

FormatInt8 turns an int8 into a string

func FormatUint16 Uses

func FormatUint16(value uint16) string

FormatUint16 turns an uint16 into a string

func FormatUint32 Uses

func FormatUint32(value uint32) string

FormatUint32 turns an uint32 into a string

func FormatUint64 Uses

func FormatUint64(value uint64) string

FormatUint64 turns an uint64 into a string

func FormatUint8 Uses

func FormatUint8(value uint8) string

FormatUint8 turns an uint8 into a string

func FromDynamicJSON Uses

func FromDynamicJSON(data, target interface{}) error

FromDynamicJSON turns an object into a properly JSON typed structure

func FullGoSearchPath Uses

func FullGoSearchPath() string

FullGoSearchPath gets the search paths for finding packages

func Int Uses

func Int(v int) *int

Int returns a pointer to of the int value passed in.

func Int32 Uses

func Int32(v int32) *int32

Int32 returns a pointer to of the int64 value passed in.

func Int32Map Uses

func Int32Map(src map[string]int32) map[string]*int32

Int32Map converts a string map of int32 values into a string map of int32 pointers

func Int32Slice Uses

func Int32Slice(src []int32) []*int32

Int32Slice converts a slice of int64 values into a slice of int32 pointers

func Int32Value Uses

func Int32Value(v *int32) int32

Int32Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.

func Int32ValueMap Uses

func Int32ValueMap(src map[string]*int32) map[string]int32

Int32ValueMap converts a string map of int32 pointers into a string map of int32 values

func Int32ValueSlice Uses

func Int32ValueSlice(src []*int32) []int32

Int32ValueSlice converts a slice of int32 pointers into a slice of int32 values

func Int64 Uses

func Int64(v int64) *int64

Int64 returns a pointer to of the int64 value passed in.

func Int64Map Uses

func Int64Map(src map[string]int64) map[string]*int64

Int64Map converts a string map of int64 values into a string map of int64 pointers

func Int64Slice Uses

func Int64Slice(src []int64) []*int64

Int64Slice converts a slice of int64 values into a slice of int64 pointers

func Int64Value Uses

func Int64Value(v *int64) int64

Int64Value returns the value of the int64 pointer passed in or 0 if the pointer is nil.

func Int64ValueMap Uses

func Int64ValueMap(src map[string]*int64) map[string]int64

Int64ValueMap converts a string map of int64 pointers into a string map of int64 values

func Int64ValueSlice Uses

func Int64ValueSlice(src []*int64) []int64

Int64ValueSlice converts a slice of int64 pointers into a slice of int64 values

func IntMap Uses

func IntMap(src map[string]int) map[string]*int

IntMap converts a string map of int values into a string map of int pointers

func IntSlice Uses

func IntSlice(src []int) []*int

IntSlice converts a slice of int values into a slice of int pointers

func IntValue Uses

func IntValue(v *int) int

IntValue returns the value of the int pointer passed in or 0 if the pointer is nil.

func IntValueMap Uses

func IntValueMap(src map[string]*int) map[string]int

IntValueMap converts a string map of int pointers into a string map of int values

func IntValueSlice Uses

func IntValueSlice(src []*int) []int

IntValueSlice converts a slice of int pointers into a slice of int values

func IsFloat64AJSONInteger Uses

func IsFloat64AJSONInteger(f float64) bool

IsFloat64AJSONInteger allow for integers [-2^53, 2^53-1] inclusive

func IsZero Uses

func IsZero(data interface{}) bool

IsZero returns true when the value passed into the function is a zero value. This allows for safer checking of interface values.

func JoinByFormat Uses

func JoinByFormat(data []string, format string) []string

JoinByFormat joins a string array by a known format:

ssv: space separated value
tsv: tab separated value
pipes: pipe (|) separated value
csv: comma separated value (default)

func LoadFromFileOrHTTP Uses

func LoadFromFileOrHTTP(path string) ([]byte, error)

LoadFromFileOrHTTP loads the bytes from a file or a remote http server based on the path passed in

func LoadFromFileOrHTTPWithTimeout Uses

func LoadFromFileOrHTTPWithTimeout(path string, timeout time.Duration) ([]byte, error)

LoadFromFileOrHTTPWithTimeout loads the bytes from a file or a remote http server based on the path passed in timeout arg allows for per request overriding of the request timeout

func LoadStrategy Uses

func LoadStrategy(path string, local, remote func(string) ([]byte, error)) func(string) ([]byte, error)

LoadStrategy returns a loader function for a given path or uri

func ReadJSON Uses

func ReadJSON(data []byte, value interface{}) error

ReadJSON reads json data, prefers finding an appropriate interface to short-circuit the unmarshaller so it takes the fastes option available

func SplitByFormat Uses

func SplitByFormat(data, format string) []string

SplitByFormat splits a string by a known format:

ssv: space separated value
tsv: tab separated value
pipes: pipe (|) separated value
csv: comma separated value (default)

func SplitHostPort Uses

func SplitHostPort(addr string) (host string, port int, err error)

SplitHostPort splits a network address into a host and a port. The port is -1 when there is no port to be found

func String Uses

func String(v string) *string

String returns a pointer to of the string value passed in.

func StringMap Uses

func StringMap(src map[string]string) map[string]*string

StringMap converts a string map of string values into a string map of string pointers

func StringSlice Uses

func StringSlice(src []string) []*string

StringSlice converts a slice of string values into a slice of string pointers

func StringValue Uses

func StringValue(v *string) string

StringValue returns the value of the string pointer passed in or "" if the pointer is nil.

func StringValueMap Uses

func StringValueMap(src map[string]*string) map[string]string

StringValueMap converts a string map of string pointers into a string map of string values

func StringValueSlice Uses

func StringValueSlice(src []*string) []string

StringValueSlice converts a slice of string pointers into a slice of string values

func Time Uses

func Time(v time.Time) *time.Time

Time returns a pointer to of the time.Time value passed in.

func TimeMap Uses

func TimeMap(src map[string]time.Time) map[string]*time.Time

TimeMap converts a string map of time.Time values into a string map of time.Time pointers

func TimeSlice Uses

func TimeSlice(src []time.Time) []*time.Time

TimeSlice converts a slice of time.Time values into a slice of time.Time pointers

func TimeValue Uses

func TimeValue(v *time.Time) time.Time

TimeValue returns the value of the time.Time pointer passed in or time.Time{} if the pointer is nil.

func TimeValueMap Uses

func TimeValueMap(src map[string]*time.Time) map[string]time.Time

TimeValueMap converts a string map of time.Time pointers into a string map of time.Time values

func TimeValueSlice Uses

func TimeValueSlice(src []*time.Time) []time.Time

TimeValueSlice converts a slice of time.Time pointers into a slice of time.Time values

func ToCommandName Uses

func ToCommandName(name string) string

ToCommandName lowercases and underscores a go type name

func ToDynamicJSON Uses

func ToDynamicJSON(data interface{}) interface{}

ToDynamicJSON turns an object into a properly JSON typed structure

func ToFileName Uses

func ToFileName(name string) string

ToFileName lowercases and underscores a go type name

func ToGoName Uses

func ToGoName(name string) string

ToGoName translates a swagger name which can be underscored or camel cased to a name that golint likes

func ToHumanNameLower Uses

func ToHumanNameLower(name string) string

ToHumanNameLower represents a code name as a human series of words

func ToHumanNameTitle Uses

func ToHumanNameTitle(name string) string

ToHumanNameTitle represents a code name as a human series of words with the first letters titleized

func ToJSONName Uses

func ToJSONName(name string) string

ToJSONName camelcases a name which can be underscored or pascal cased

func ToVarName Uses

func ToVarName(name string) string

ToVarName camelcases a name which can be underscored or pascal cased

func Uint Uses

func Uint(v uint) *uint

Uint returns a pouinter to of the uint value passed in.

func Uint32 Uses

func Uint32(v uint32) *uint32

Uint32 returns a pouinter to of the uint64 value passed in.

func Uint32Map Uses

func Uint32Map(src map[string]uint32) map[string]*uint32

Uint32Map converts a string map of uint32 values uinto a string map of uint32 pouinters

func Uint32Slice Uses

func Uint32Slice(src []uint32) []*uint32

Uint32Slice converts a slice of uint64 values uinto a slice of uint32 pouinters

func Uint32Value Uses

func Uint32Value(v *uint32) uint32

Uint32Value returns the value of the uint64 pouinter passed in or 0 if the pouinter is nil.

func Uint32ValueMap Uses

func Uint32ValueMap(src map[string]*uint32) map[string]uint32

Uint32ValueMap converts a string map of uint32 pouinters uinto a string map of uint32 values

func Uint32ValueSlice Uses

func Uint32ValueSlice(src []*uint32) []uint32

Uint32ValueSlice converts a slice of uint32 pouinters uinto a slice of uint32 values

func Uint64 Uses

func Uint64(v uint64) *uint64

Uint64 returns a pouinter to of the uint64 value passed in.

func Uint64Map Uses

func Uint64Map(src map[string]uint64) map[string]*uint64

Uint64Map converts a string map of uint64 values uinto a string map of uint64 pouinters

func Uint64Slice Uses

func Uint64Slice(src []uint64) []*uint64

Uint64Slice converts a slice of uint64 values uinto a slice of uint64 pouinters

func Uint64Value Uses

func Uint64Value(v *uint64) uint64

Uint64Value returns the value of the uint64 pouinter passed in or 0 if the pouinter is nil.

func Uint64ValueMap Uses

func Uint64ValueMap(src map[string]*uint64) map[string]uint64

Uint64ValueMap converts a string map of uint64 pouinters uinto a string map of uint64 values

func Uint64ValueSlice Uses

func Uint64ValueSlice(src []*uint64) []uint64

Uint64ValueSlice converts a slice of uint64 pouinters uinto a slice of uint64 values

func UintMap Uses

func UintMap(src map[string]uint) map[string]*uint

UintMap converts a string map of uint values uinto a string map of uint pouinters

func UintSlice Uses

func UintSlice(src []uint) []*uint

UintSlice converts a slice of uint values uinto a slice of uint pouinters

func UintValue Uses

func UintValue(v *uint) uint

UintValue returns the value of the uint pouinter passed in or 0 if the pouinter is nil.

func UintValueMap Uses

func UintValueMap(src map[string]*uint) map[string]uint

UintValueMap converts a string map of uint pouinters uinto a string map of uint values

func UintValueSlice Uses

func UintValueSlice(src []*uint) []uint

UintValueSlice converts a slice of uint pouinters uinto a slice of uint values

func WriteJSON Uses

func WriteJSON(data interface{}) ([]byte, error)

WriteJSON writes json data, prefers finding an appropriate interface to short-circuit the marshaller so it takes the fastest option available.

func YAMLData Uses

func YAMLData(path string) (interface{}, error)

YAMLData loads a yaml document from either http or a file

func YAMLDoc Uses

func YAMLDoc(path string) (json.RawMessage, error)

YAMLDoc loads a yaml document from either http or a file and converts it to json

func YAMLMatcher Uses

func YAMLMatcher(path string) bool

YAMLMatcher matches yaml

func YAMLToJSON Uses

func YAMLToJSON(data interface{}) (json.RawMessage, error)

YAMLToJSON converts YAML unmarshaled data into json compatible data

type CommandLineOptionsGroup Uses

type CommandLineOptionsGroup struct {
    ShortDescription string
    LongDescription  string
    Options          interface{}
}

CommandLineOptionsGroup represents a group of user-defined command line options

type JSONMapItem Uses

type JSONMapItem struct {
    Key   string
    Value interface{}
}

func (JSONMapItem) MarshalEasyJSON Uses

func (s JSONMapItem) MarshalEasyJSON(w *jwriter.Writer)

func (JSONMapItem) MarshalJSON Uses

func (s JSONMapItem) MarshalJSON() ([]byte, error)

func (*JSONMapItem) UnmarshalEasyJSON Uses

func (s *JSONMapItem) UnmarshalEasyJSON(in *jlexer.Lexer)

func (*JSONMapItem) UnmarshalJSON Uses

func (s *JSONMapItem) UnmarshalJSON(data []byte) error

type JSONMapSlice Uses

type JSONMapSlice []JSONMapItem

func (JSONMapSlice) MarshalEasyJSON Uses

func (s JSONMapSlice) MarshalEasyJSON(w *jwriter.Writer)

func (JSONMapSlice) MarshalJSON Uses

func (s JSONMapSlice) MarshalJSON() ([]byte, error)

func (*JSONMapSlice) UnmarshalEasyJSON Uses

func (s *JSONMapSlice) UnmarshalEasyJSON(in *jlexer.Lexer)

func (*JSONMapSlice) UnmarshalJSON Uses

func (s *JSONMapSlice) UnmarshalJSON(data []byte) error

type NameProvider Uses

type NameProvider struct {
    // contains filtered or unexported fields
}

NameProvider represents an object capabale of translating from go property names to json property names This type is thread-safe.

func NewNameProvider Uses

func NewNameProvider() *NameProvider

NewNameProvider creates a new name provider

func (*NameProvider) GetGoName Uses

func (n *NameProvider) GetGoName(subject interface{}, name string) (string, bool)

GetGoName gets the go name for a json property name

func (*NameProvider) GetGoNameForType Uses

func (n *NameProvider) GetGoNameForType(tpe reflect.Type, name string) (string, bool)

GetGoNameForType gets the go name for a given type for a json property name

func (*NameProvider) GetJSONName Uses

func (n *NameProvider) GetJSONName(subject interface{}, name string) (string, bool)

GetJSONName gets the json name for a go property name

func (*NameProvider) GetJSONNameForType Uses

func (n *NameProvider) GetJSONNameForType(tpe reflect.Type, name string) (string, bool)

GetJSONNameForType gets the json name for a go property name on a given type

func (*NameProvider) GetJSONNames Uses

func (n *NameProvider) GetJSONNames(subject interface{}) []string

GetJSONNames gets all the json property names for a type

Package swag imports 22 packages (graph) and is imported by 154 packages. Updated 2017-06-06. Refresh now. Tools for package owners.