swagger

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 24, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OASv2  = "2.0"
	OASv30 = "3.0.0"
	OASv31 = "3.1.0"
)
View Source
const SwaggerPrefix = "swagger"
View Source
const (
	TagSwaggerPath = "swaggerPath"
)

Variables

View Source
var Content embed.FS
View Source
var Module = &bootstrap.Module{
	Name:       "swagger",
	Precedence: bootstrap.SwaggerPrecedence,
	PriorityOptions: []fx.Option{
		fx.Invoke(configureSecurity),
	},
	Options: []fx.Option{
		appconfig.FxEmbeddedDefaults(defaultConfigFS),
		fx.Provide(
			bindSwaggerProperties,
			fx.Annotate(newSwaggerInfoDiscoveryCustomizer, fx.ResultTags(fmt.Sprintf(`group:"%s"`, discovery.FxGroup))),
		),
		fx.Invoke(initialize),
	},
}

Functions

func Use

func Use()

Types

type DiscoveryCustomizerDIOut

type DiscoveryCustomizerDIOut struct {
	fx.Out

	Customizer discovery.ServiceRegistrationCustomizer `group:"discovery_customizer"`
}

type OAS2

type OAS2 struct {
	OpenAPIVersion string                 `json:"swagger"`
	Info           OAS2Info               `json:"info"`
	Host           string                 `json:"host,omitempty"`
	BasePath       string                 `json:"basePath,omitempty"`
	Schemes        []string               `json:"schemes,omitempty"`
	Consumes       []string               `json:"consumes,omitempty"`
	Produces       []string               `json:"produces,omitempty"`
	Paths          map[string]interface{} `json:"paths,omitempty"`
	Definitions    map[string]interface{} `json:"definitions,omitempty"`
	Parameters     map[string]interface{} `json:"parameters,omitempty"`
	Responses      map[string]interface{} `json:"responses,omitempty"`
	SecDefs        map[string]interface{} `json:"securityDefinitions,omitempty"`
	Security       []interface{}          `json:"security,omitempty"`
	Tags           []interface{}          `json:"tags,omitempty"`
	ExtDocs        map[string]interface{} `json:"externalDocs,omitempty"`
}

OAS2 is Swagger 2.0 Specification https://swagger.io/docs/specification/2-0/basic-structure/ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/2.0.md

type OAS2Info

type OAS2Info struct {
	Title          string                 `json:"title"`
	Description    string                 `json:"description,omitempty"`
	TermsOfService string                 `json:"termsOfService,omitempty"`
	Contact        map[string]interface{} `json:"contact,omitempty"`
	License        map[string]interface{} `json:"license,omitempty"`
	Version        string                 `json:"version,omitempty"`
}

type OAS3

type OAS3 struct {
	OpenAPIVersion string                 `json:"openapi"`
	Info           OAS3Info               `json:"info"`
	JsonDialect    string                 `json:"jsonSchemaDialect,omitempty"`
	Servers        []OAS3Server           `json:"servers,omitempty"`
	Paths          map[string]interface{} `json:"paths,omitempty"`
	WebHooks       map[string]interface{} `json:"webhooks,omitempty"`
	Components     map[string]interface{} `json:"components,omitempty"`
	Security       []interface{}          `json:"security,omitempty"`
	Tags           []interface{}          `json:"tags,omitempty"`
	ExtDocs        map[string]interface{} `json:"externalDocs,omitempty"`
}

OAS3 is Swagger 3.0 Specification https://swagger.io/docs/specification/basic-structure/ https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#schema

type OAS3Info

type OAS3Info struct {
	Title          string                 `json:"title"`
	Summary        string                 `json:"summary,omitempty"`
	Description    string                 `json:"description,omitempty"`
	TermsOfService string                 `json:"termsOfService,omitempty"`
	Contact        map[string]interface{} `json:"contact,omitempty"`
	License        map[string]interface{} `json:"license,omitempty"`
	Version        string                 `json:"version,omitempty"`
}

type OAS3Server

type OAS3Server struct {
	URL         string                 `json:"url"`
	Description string                 `json:"description,omitempty"`
	Variables   map[string]interface{} `json:"variables,omitempty"`
}

type OASDocLoader

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

func (OASDocLoader) Load

func (l OASDocLoader) Load() (*OpenApiSpec, error)

type OASVersion

type OASVersion string

type OpenApiSpec

type OpenApiSpec struct {
	Version OASVersion `json:"Version"`
	OAS2    *OAS2      `json:"OAS2"`
	OAS3    *OAS3      `json:"OAS3"`
}

func (*OpenApiSpec) UnmarshalJSON

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

type ParamMeta

type ParamMeta struct {
	Name               string `json:"name"`
	DisplayName        string `json:"displayName"`
	CandidateSourceUrl string `json:"candidateSourceUrl"`
	CandidateJsonPath  string `json:"candidateJsonPath"`
}

type ParameterProperties

type ParameterProperties struct {
	Name               string `json:"name"`
	DisplayName        string `json:"display-name"`
	CandidateSourceUrl string `json:"candidate-source-url"`
	CandidateJsonPath  string `json:"candidate-json-path"`
}

type Resource

type Resource struct {
	Name           string `json:"name"`
	Location       string `json:"location"`
	Url            string `json:"url"`
	SwaggerVersion string `json:"swaggerVersion"`
}

type SsoConfiguration

type SsoConfiguration struct {
	Enabled          bool        `json:"enabled"`
	AuthorizeUrl     string      `json:"authorizeUrl"`
	ClientId         string      `json:"clientId"`
	ClientSecret     string      `json:"clientSecret"`
	TokenUrl         string      `json:"tokenUrl"`
	AdditionalParams []ParamMeta `json:"additionalParameters"`
}

type SwaggerController

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

func NewSwaggerController

func NewSwaggerController(props SwaggerProperties, resolver bootstrap.BuildInfoResolver) *SwaggerController

func (*SwaggerController) Mappings

func (c *SwaggerController) Mappings() []web.Mapping

type SwaggerProperties

type SwaggerProperties struct {
	BasePath string                    `json:"base-path"`
	Spec     string                    `json:"spec"`
	Security SwaggerSecurityProperties `json:"security"`
	UI       SwaggerUIProperties       `json:"ui"`
}

func NewSwaggerSsoProperties

func NewSwaggerSsoProperties() *SwaggerProperties

type SwaggerSecurityProperties

type SwaggerSecurityProperties struct {
	SecureDocs bool                 `json:"secure-docs"`
	Sso        SwaggerSsoProperties `json:"sso"`
}

type SwaggerSsoProperties

type SwaggerSsoProperties struct {
	BaseUrl          string                `json:"base-url"`
	TokenPath        string                `json:"token-path"`
	AuthorizePath    string                `json:"authorize-path"`
	ClientId         string                `json:"client-id"`
	ClientSecret     string                `json:"client-secret"`
	AdditionalParams []ParameterProperties `json:"additional-params" binding:"omitempty"`
}

type SwaggerUIProperties

type SwaggerUIProperties struct {
	Title string `json:"title"`
}

type UiConfiguration

type UiConfiguration struct {
	ApisSorter               string   `json:"apisSorter"`
	DeepLinking              bool     `json:"deepLinking"`
	DefaultModelExpandDepth  int      `json:"defaultModelExpandDepth"`
	DefaultModelRendering    string   `json:"defaultModelRendering"`
	DefaultModelsExpandDepth int      `json:"defaultModelsExpandDepth"`
	DisplayOperationId       bool     `json:"displayOperationId"`
	DisplayRequestDuration   bool     `json:"displayRequestDuration"`
	DocExpansion             string   `json:"docExpansion"`
	Filter                   bool     `json:"filter"`
	JsonEditor               bool     `json:"jsonEditor"`
	OperationsSorter         string   `json:"operationsSorter"`
	ShowExtensions           bool     `json:"showExtensions"`
	ShowRequestHeaders       bool     `json:"showRequestHeaders"`
	SupportedSubmitMethods   []string `json:"supportedSubmitMethods"`
	TagsSorter               string   `json:"tagsSorter"`
	ValidatorUrl             string   `json:"validatorUrl"`
	Title                    string   `json:"title"`
}

Jump to

Keyboard shortcuts

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