openapi

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2026 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ClientRequestLogger added in v0.0.3

func ClientRequestLogger(l *slog.Logger) func(ctx context.Context, req *http.Request) error

func SpecHandler

func SpecHandler(prov SpecFileProvider) func(w http.ResponseWriter, r *http.Request)

SpecHandler is http handler that serves openapi spec embedded into application. common use of this handler is something like:

r := mux.NewRouter()
r.HandleFunc("/spec/opeanapi.v1.json", openapi.SpecHandler(api.PathToRawSpec))

Types

type HttpRequestDoer added in v0.0.3

type HttpRequestDoer interface {
	Do(req *http.Request) (*http.Response, error)
}

func ClientResponseLogger added in v0.0.3

func ClientResponseLogger(d HttpRequestDoer, l *slog.Logger) HttpRequestDoer

type SpecFileProvider

type SpecFileProvider func(pathToFile string) map[string]func() ([]byte, error)

SpecFileProvider is function similar to PathToRawSpec generated by oapi-codegen see https://github.com/oapi-codegen/oapi-codegen/blob/bdc4edce7476be0791dc670d695fd78378e0e9b6/pkg/codegen/templates/inline.tmpl#L38

Jump to

Keyboard shortcuts

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