codescan

package
v0.0.0-...-9f25265 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2023 License: Apache-2.0 Imports: 21 Imported by: 0

README

codescan

Version of the go source parser with support for go modules, from go1.11 onwards.

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

func Run

func Run(opts *Options) (*spec.Swagger, error)

Run the scanner to produce a spec with the options provided

Types

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
}

Options for the scanner

Jump to

Keyboard shortcuts

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