Documentation
¶
Index ¶
- Variables
- func ElementsDocuments(e *echo.Echo, pathPrefix string, config ElementsConfig)
- func ElementsDocumentsHandler(config ElementsConfig) echo.HandlerFunc
- func RedocDocuments(e *echo.Echo, pathPrefix string, config RedocConfig)
- func RedocDocumentsHandler(config RedocConfig) echo.HandlerFunc
- func ScalarDocuments(e *echo.Echo, pathPrefix string, config ScalarConfig)
- func ScalarDocumentsHandler(config ScalarConfig) echo.HandlerFunc
- func SwaggerUIDocuments(e *echo.Echo, pathPrefix string, config SwaggerUIConfig)
- func SwaggerUIDocumentsHandler(config SwaggerUIConfig) echo.HandlerFunc
- type ElementsConfig
- type ElementsLayout
- type ElementsRouter
- type ElementsTryItCredentialsPolicy
- type RedocConfig
- type ScalarConfig
- type ScalarLayout
- type ScalarTheme
- type SwaggerUIConfig
Constants ¶
This section is empty.
Variables ¶
var DefaultElementsConfig = ElementsConfig{ Spec: "", SpecUrl: "", Title: "API documentation with Stoplight Elements", Template: defaultElementsTemplate, Router: ElementsRouterHistory, Layout: ElementsLayoutSidebar, HideInternal: false, HideTryIt: false, HideSchemas: false, HideExport: false, TryItCorsProxy: "", TryItCredentialsPolicy: ElementsTryItCredentialsPolicyOmit, Logo: "", }
var DefaultRedocConfig = RedocConfig{
Spec: "",
SpecUrl: "",
Title: "API documentation with Redoc",
Template: defaultRedocTemplate,
MinCharacterLengthToInitSearch: 0,
}
var DefaultScalarConfig = ScalarConfig{ Spec: "", SpecUrl: "", Title: "API documentation with Scalar", Template: defaultScalarTemplate, IsEditable: false, ProxyUrl: "", DarkMode: false, Layout: ScalarLayoutModern, Theme: ScalarThemeDefault, HideSidebar: false, SearchHotKey: "", }
var DefaultSwaggerUIConfig = SwaggerUIConfig{ Spec: "", SpecUrl: "", Title: "API documentation with Swagger UI", Template: defaultSwaggerUITemplate, DeepLinking: false, DisplayOperationId: false, }
Functions ¶
func ElementsDocuments ¶
func ElementsDocuments(e *echo.Echo, pathPrefix string, config ElementsConfig)
ElementsDocuments registers a handler to serve the OpenAPI documentation with Stoplight Elements.
func ElementsDocumentsHandler ¶
func ElementsDocumentsHandler(config ElementsConfig) echo.HandlerFunc
ElementsDocumentsHandler returns an echo.HandlerFunc to serve the OpenAPI documentation with Stoplight Elements.
func RedocDocuments ¶
func RedocDocuments(e *echo.Echo, pathPrefix string, config RedocConfig)
func RedocDocumentsHandler ¶
func RedocDocumentsHandler(config RedocConfig) echo.HandlerFunc
func ScalarDocuments ¶
func ScalarDocuments(e *echo.Echo, pathPrefix string, config ScalarConfig)
ScalarDocuments registers a handler to serve the OpenAPI documentation with Scalar.
func ScalarDocumentsHandler ¶
func ScalarDocumentsHandler(config ScalarConfig) echo.HandlerFunc
ScalarDocumentsHandler returns an echo.HandlerFunc to serve the OpenAPI documentation with Scalar.
func SwaggerUIDocuments ¶
func SwaggerUIDocuments(e *echo.Echo, pathPrefix string, config SwaggerUIConfig)
SwaggerUIDocuments registers a handler for serving Swagger UI documents.
func SwaggerUIDocumentsHandler ¶
func SwaggerUIDocumentsHandler(config SwaggerUIConfig) echo.HandlerFunc
Types ¶
type ElementsConfig ¶
type ElementsConfig struct { // Spec is the OpenAPI specification. Spec string // SpecUrl is the URL of the OpenAPI specification. If Spec is not empty, SpecUrl is ignored. SpecUrl string // Title is the title of the page. Title string // Template is a template string for rendering the page with html/template. Template string // Router is the Elements `router` configuration. Router ElementsRouter // Layout is the Elements `layout` configuration. Layout ElementsLayout // HideInternal is the Elements `hideInternal` configuration. HideInternal bool // HideTryIt is the Elements `hideTryIt` configuration. HideTryIt bool // HideSchemas is the Elements `hideSchemas` configuration. HideSchemas bool // HideExport is the Elements `hideExport` configuration. HideExport bool // TryItCorsProxy is the Elements `tryItCorsProxy` configuration. TryItCorsProxy string // TryItCredentialsPolicy is the Elements `tryItCredentialsPolicy` configuration. TryItCredentialsPolicy ElementsTryItCredentialsPolicy // Logo is the Elements `logo` configuration. Logo string }
ElementsConfig is the configuration for ElementsDocumentsHandler to generate the OpenAPI documentation with Stoplight Elements. Some fields are Elements configuration options. See https://github.com/stoplightio/elements/blob/main/docs/getting-started/elements/elements-options.md
type ElementsLayout ¶
type ElementsLayout string
const ( ElementsLayoutSidebar ElementsLayout = "sidebar" ElementsLayoutResponsive ElementsLayout = "responsive" ElementsLayoutStacked ElementsLayout = "stacked" )
type ElementsRouter ¶
type ElementsRouter string
const ( ElementsRouterHash ElementsRouter = "hash" ElementsRouterHistory ElementsRouter = "history" ElementsRouterMemory ElementsRouter = "memory" )
type ElementsTryItCredentialsPolicy ¶
type ElementsTryItCredentialsPolicy string
const ( ElementsTryItCredentialsPolicyOmit ElementsTryItCredentialsPolicy = "omit" ElementsTryItCredentialsInclude ElementsTryItCredentialsPolicy = "include" ElementsTryItCredentialsSameOrigin ElementsTryItCredentialsPolicy = "same-origin" )
type RedocConfig ¶
type RedocConfig struct { // Spec is the OpenAPI specification. Spec string // SpecUrl is the URL of the OpenAPI specification. If Spec is not empty, SpecUrl is ignored. SpecUrl string // Title is the title of the page. Title string // Template is a template string for rendering the page with html/template. Template string // DisableSearch is the Redoc `disableSearch` configuration. DisableSearch bool // MinCharacterLengthToInitSearch is the Redoc `minCharacterLengthToInitSearch` configuration. MinCharacterLengthToInitSearch int }
RedocConfig is the configuration for RedocDocumentsHandler to generate the OpenAPI documentation with Redoc. Some fields are Redoc configuration options. See https://github.com/Redocly/redoc/blob/main/docs/config.md
type ScalarConfig ¶
type ScalarConfig struct { // Spec is the OpenAPI specification. Spec string // SpecUrl is the URL of the OpenAPI specification. If Spec is not empty, SpecUrl is ignored. SpecUrl string // Title is the title of the page. Title string // Template is a template string for rendering the page with html/template. Template string // IsEditable is the Scalar `isEditable` configuration. IsEditable bool // ProxyUrl is the Scalar `proxyUrl` configuration. ProxyUrl string // DarkMode is the Scalar `darkMode` configuration. DarkMode bool // Layout is the Scalar `layout` configuration. Layout ScalarLayout // Theme is the Scalar `theme` configuration. Theme ScalarTheme // HideSidebar is the inverse of the Scalar `showSidebar` configuration. // If HideSidebar is true, the `showSidebar` configuration is false. // Scalar has a default value of `showSidebar` as true, so if you want to hide the sidebar, set this value to true. HideSidebar bool // SearchHotKey is the Scalar `searchHotKey` configuration. SearchHotKey string }
ScalarConfig is the configuration for ScalarDocumentsHandler to generate the OpenAPI documentation with Scalar. Some fields are Scalar configuration options. See https://github.com/scalar/scalar?tab=readme-ov-file#configuration
type ScalarLayout ¶
type ScalarLayout string
const ( ScalarLayoutModern ScalarLayout = "modern" ScalarLayoutClassic ScalarLayout = "classic" )
type ScalarTheme ¶
type ScalarTheme string
ScalarTheme is the Scalar theme configuration. https://github.com/scalar/scalar?tab=readme-ov-file#themes
const ( ScalarThemeAlternate ScalarTheme = "alternate" ScalarThemeDefault ScalarTheme = "default" ScalarThemeMoon ScalarTheme = "moon" ScalarThemePurple ScalarTheme = "purple" ScalarThemeSolarized ScalarTheme = "solarized" ScalarThemeBluePlanet ScalarTheme = "bluePlanet" ScalarThemeSaturn ScalarTheme = "saturn" ScalarThemeMars ScalarTheme = "mars" ScalarThemeDeepSpace ScalarTheme = "deepSpace" ScalarThemeNone ScalarTheme = "none" )
type SwaggerUIConfig ¶
type SwaggerUIConfig struct { // Spec is the OpenAPI specification. Spec string // SpecUrl is the URL of the OpenAPI specification. If Spec is not empty, SpecUrl is ignored. SpecUrl string // Title is the title of the page. Title string // Template is a template string for rendering the page with html/template. Template string // DeepLinking is the Swagger UI `deepLinking` configuration. DeepLinking bool // DisplayOperationId is the Swagger UI `DisplayOperationId` configuration. DisplayOperationId bool }
SwaggerUIConfig is the configuration for SwaggerUIDocumentsHandler to generate the OpenAPI documentation with Swagger UI. Some fields are Swagger UI configuration options. See https://github.com/swagger-api/swagger-ui/blob/master/docs/usage/configuration.md