swagen

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BuildSchemaValidation

func BuildSchemaValidation(schema *openapi3.SchemaRef, validationString string, fieldInterface string)

func GenerateControllersSpec

func GenerateControllersSpec(openapi *openapi3.T, config *OpenAPIGeneratorConfig, defs []definitions.ControllerMetadata)

func GenerateModelsSpec

func GenerateModelsSpec(openapi *openapi3.T, models []definitions.ModelMetadata)

func GenerateSecuritySpec

func GenerateSecuritySpec(openapi *openapi3.T, securityConfig *[]SecuritySchemeConfig)

func GenerateSpec

func GenerateSpec(config OpenAPIGeneratorConfig, defs []definitions.ControllerMetadata, models []definitions.ModelMetadata)

GenerateSpec generates the OpenAPI specification

func GetArrayItemType

func GetArrayItemType(fieldType string) string

Helper function to determine the item type of an array

func HttpStatusCodeToString

func HttpStatusCodeToString(httpStatusCode definitions.HttpStatusCode) string

func InterfaceToSchemaRef

func InterfaceToSchemaRef(openapi *openapi3.T, interfaceType string) *openapi3.SchemaRef

func IsFieldRequired

func IsFieldRequired(validationString string) bool

func IsPrimitiveType

func IsPrimitiveType(typeName string) bool

func IsSecurityNameInSecuritySchemes

func IsSecurityNameInSecuritySchemes(securitySchemes []SecuritySchemeConfig, securityName string) bool

func ParseBool

func ParseBool(value string) *bool

Helper function to parse boolean validation values

func ParseInteger

func ParseInteger(value string) *uint64

Helper function to parse integer validation values

func ParseNumber

func ParseNumber(value string) *float64

Helper function to parse numeric validation values

func ToOpenApiSchema

func ToOpenApiSchema(typeName string) *openapi3.Schema

func ToOpenApiSchemaRef

func ToOpenApiSchemaRef(typeName string) *openapi3.SchemaRef

func ToOpenApiType

func ToOpenApiType(typeName string) string

Types

type OpenAPIGeneratorConfig

type OpenAPIGeneratorConfig struct {
	Info                 openapi3.Info               `json:"info"`
	BaseURL              string                      `json:"base_url"`
	SecuritySchemes      []SecuritySchemeConfig      `json:"securitySchemes"`
	DefaultRouteSecurity []definitions.RouteSecurity `json:"defaultSecurity"`
}

type SchemaRefMap

type SchemaRefMap struct {
	InterfaceType string
	SchemaRef     *openapi3.SchemaRef
}

type SecuritySchemeConfig

type SecuritySchemeConfig struct {
	Description  string                         `json:"description"`
	SecurityName string                         `json:"name"`
	FieldName    string                         `json:"fieldName"`
	Type         definitions.SecuritySchemeType `json:"type"`
	In           definitions.SecuritySchemeIn   `json:"in"`
}

Jump to

Keyboard shortcuts

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