Documentation ¶
Index ¶
Constants ¶
View Source
const ( EncodingWwwUrlencode = "application/x-www-form-urlencoded" EncodingJSON = "application/json" EncodingJSONText = "text/json" EncodingXML = "application/xml" EncodingXMLText = "text/xml" EncodingFormData = "multipart/form-data" EncodingPHP = "php" )
View Source
const ( // LanguageCurl curl LanguageCurl = Language("curl") LanguagePhp = Language("php") LanguageJS = Language("js") LanguageEmpty = Language("") )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeSample ¶
type CodeSample struct { Lang Language `yaml:"lang" json:"lang"` // language of the sample Source string `yaml:"source" json:"source"` // the actual source code Label string `yaml:"label" json:"label"` // displayed language name }
CodeSample represents a single code example
type Encoder ¶
type Encoder interface { EnocdeValue(ref string, value interface{}, meta *FormattingMeta) (string, error) EnocdeParameter(name string, value interface{}) (string, error) }
Encoder defines an interface for encoding
type Extractor ¶
type Extractor interface { GetParameters(params openapi3.Parameters) (Parameters, error) GetPathExample(path string, params []*Parameter) string GetURL(operation *openapi3.Operation, pathItem *openapi3.PathItem, document *openapi3.T) string GetRequestBody(body *openapi3.RequestBody) (value interface{}, format string, err error) GetExampleValueForSchema(schema *openapi3.Schema, format string) (interface{}, error) GetSecurity(operation *openapi3.Operation, document *openapi3.T) (params Parameters, basicAuth bool, err error) }
Extractor defines an interface for feature extractors
type FormattingMeta ¶
FormattingMeta holds meta data for formatting
type Generator ¶
type Generator interface {
GetSample(httpVerb string, path string, operation *openapi3.Operation, pathItem *openapi3.PathItem, document *openapi3.T) (*CodeSample, error)
}
Generator is an interface for language specific generators to adopt
type Language ¶
type Language string
Language enum
func StringToLanguage ¶
StringToLanguage maps a string value to it's corresponding language type
Click to show internal directories.
Click to hide internal directories.