Documentation
¶
Overview ¶
Package codescan provides a scanner for go files that produces a swagger spec document.
This package is intendnd for go1.11 onwards, and does support go modules.
Index ¶
Constants ¶
View Source
const ( // ParamDescriptionKey indicates the tag used to define a parameter description in swagger:route. ParamDescriptionKey = "description" // ParamNameKey indicates the tag used to define a parameter name in swagger:route. ParamNameKey = "name" // ParamInKey indicates the tag used to define a parameter location in swagger:route. ParamInKey = "in" // ParamRequiredKey indicates the tag used to declare whether a parameter is required in swagger:route. ParamRequiredKey = "required" // ParamTypeKey indicates the tag used to define the parameter type in swagger:route. ParamTypeKey = "type" // ParamAllowEmptyKey indicates the tag used to indicate whether a parameter allows empty values in swagger:route. ParamAllowEmptyKey = "allowempty" // SchemaMinKey indicates the tag used to indicate the minimum value allowed for this type in swagger:route. SchemaMinKey = "min" // SchemaMaxKey indicates the tag used to indicate the maximum value allowed for this type in swagger:route. SchemaMaxKey = "max" // SchemaEnumKey indicates the tag used to specify the allowed values for this type in swagger:route. SchemaEnumKey = "enum" // SchemaFormatKey indicates the expected format for this field in swagger:route. SchemaFormatKey = "format" // SchemaDefaultKey indicates the default value for this field in swagger:route. SchemaDefaultKey = "default" // SchemaMinLenKey indicates the minimum length this field in swagger:route. SchemaMinLenKey = "minlength" // SchemaMaxLenKey indicates the minimum length this field in swagger:route. SchemaMaxLenKey = "maxlength" // TypeArray is the identifier for an array type in swagger:route. TypeArray = "array" // TypeNumber is the identifier for a number type in swagger:route. TypeNumber = "number" // TypeInteger is the identifier for an integer type in swagger:route. TypeInteger = "integer" // TypeBoolean is the identifier for a boolean type in swagger:route. TypeBoolean = "boolean" // TypeBool is the identifier for a boolean type in swagger:route. TypeBool = "bool" // TypeObject is the identifier for an object type in swagger:route. TypeObject = "object" // TypeString is the identifier for a string type in swagger:route. TypeString = "string" )
View Source
const AlphaChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
AlphaChars used when parsing for Vendor Extensions.
View Source
const BodyTag = "body"
BodyTag used when specifying a response to point to a model/schema.
View Source
const DescriptionTag = "description"
DescriptionTag used when specifying a response that gives a description of the response.
View Source
const ResponseTag = "response"
ResponseTag used when specifying a response to point to a defined swagger:response.
Variables ¶
View Source
var Debug = safeConvert(os.Getenv("DEBUG"))
Debug is true when process is run with DEBUG=1 env var.
Functions ¶
Types ¶
type Error ¶
type Error string
const (
ErrInternal Error = "internal error due to a bug or a mishandling of go types AST. This usually indicates a bug in the scanner"
)
type Options ¶
type Options struct {
Packages []string
InputSpec *spec.Swagger
ScanModels bool
WorkDir string
BuildTags string
ExcludeDeps bool
Include []string
Exclude []string
IncludeTags []string
ExcludeTags []string
SetXNullableForPointers bool
RefAliases bool // aliases result in $ref, otherwise aliases are expanded
TransparentAliases bool // aliases are completely transparent, never creating definitions
DescWithRef bool // allow overloaded descriptions together with $ref, otherwise jsonschema draft4 $ref predates everything
}
Options for the scanner.
Click to show internal directories.
Click to hide internal directories.