openapi

package
v0.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 8 Imported by: 0

README

Swagger Viewer

Requires Go 1.16+ to support the //go:embed functionality

Documentation

Index

Constants

View Source
const (
	// DefaultPath is root path docs will be served up unless configured differently
	DefaultPath = "/docs"
)

Variables

View Source
var (
	// ErrServeMuxMustNotBeNil error
	ErrServeMuxMustNotBeNil = errors.New("openapi: serve mux can not be nil")
	// ErrJSONDataMustNotBeNil error
	ErrJSONDataMustNotBeNil = errors.New("openapi: JSON data can not be nil")
)

Functions

This section is empty.

Types

type OpenAPI

type OpenAPI struct {
	Spec    spec.Swagger
	Schemes []string
	Path    string
	// contains filtered or unexported fields
}

OpenAPI holds the basic config and mux

func New

func New(mux *http.ServeMux, jsonData []byte) (*OpenAPI, error)

New initiates openapi server

func (*OpenAPI) AddSecurityScheme

func (s *OpenAPI) AddSecurityScheme(name string, scheme spec.SecurityScheme)

AddSecurityScheme is a helper to add security schemes such as OAuth2, etc.

func (*OpenAPI) Serve

func (s *OpenAPI) Serve()

Serve handles the docs, openapi.json, and server.js

Jump to

Keyboard shortcuts

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