documents

package module
v1.2.85 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2024 License: Apache-2.0 Imports: 16 Imported by: 2

README

Document

Fns document handler.

Install

go get github.com/aacfactory/fns-contrib/transports/handlers/documents

Use

fns.New(fns.Handler(documents.New()))

Config

transport:
  handlers:
    documents:
      enable: true
      openAPI:
        version: "openapi version"
        title: ""
        description: ""
        term: ""

URL

Raw document

/documents 

Openapi view (latest)

/documents/openapi/index.html

Openapi view (by version)
It will find major and miner matched.

/documents/openapi/index.html?version=v1.0

Openapi document

/documents?openapi=latest

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() transports.MuxHandler

Types

type Config

type Config struct {
	Enable  bool    `json:"enable"`
	OpenAPI OpenAPI `json:"openAPI"`
}

type Handler

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

Handler method is get url is /documents when /documents?openapi={latest|version_text}, then return openapi

func (*Handler) Construct

func (handler *Handler) Construct(options transports.MuxHandlerOptions) (err error)

func (*Handler) Handle

func (handler *Handler) Handle(w transports.ResponseWriter, r transports.Request)

func (*Handler) Match

func (handler *Handler) Match(_ context.Context, method []byte, path []byte, _ transports.Header) (ok bool)

func (*Handler) Name

func (handler *Handler) Name() string

type OpenAPI

type OpenAPI struct {
	Version     string `json:"version"`
	Title       string `json:"title"`
	Description string `json:"description"`
	Term        string `json:"term"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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