func Respond(w http.ResponseWriter, r *http.Request, data string, code int) {
	w.WriteHeader(code)
	w.Write([]byte(data))
}
Respond sends HTTP response
package openapimux
import (
	"context"
	"net/http"
	"github.com/getkin/kin-openapi/openapi3"
	"github.com/getkin/kin-openapi/openapi3filter"
	legacyrouter "github.com/getkin/kin-openapi/routers/legacy"
)
type OpenAPIMux struct {
	handler       http.Handler
	handlers      map[string]http.Handler
	middlewares   []func(http.Handler) http.Handler
	Routers       *legacyrouter.Routers
	ErrorHandler  func(http.ResponseWriter, *http.Request, string, int)
	DetailedError bool
}
type contextKey struct {
	name string
}
var pathParamsKey = &contextKey{"pathParams"}
func NewRouter(apis ...string) (*OpenAPIMux, error) {
	routers := make(legacyrouter.Routers, len(apis))
	for i, api := range apis {
		swagger, e := openapi3.NewLoader().LoadFromFile(api)
		if e != nil {
			return nil, e
		}
		route, e := legacyrouter.NewRouter(swagger)
		routers[i] = route.(*legacyrouter.Router)
	}
	return &OpenAPIMux{
		Routers:       &routers,
		ErrorHandler:  Respond,
		DetailedError: true,
	}, nil
}
func (sr *OpenAPIMux) ServeHTTP(w http.ResponseWriter, r *http.Request) {
	if sr.handler == nil {
		sr.handler = chain(sr.middlewares, http.HandlerFunc(sr.handleRequest))
	}
	sr.handler.ServeHTTP(w, r)
}
func (sr *OpenAPIMux) UseHandlers(handlers map[string]http.Handler) {
	if sr.handlers == nil {
		sr.handlers = make(map[string]http.Handler, len(handlers))
	}
	for key, h := range handlers {
		sr.handlers[key] = h
	}
}
func (sr *OpenAPIMux) UseMiddleware(middlewares ...func(http.Handler) http.Handler) {
	sr.middlewares = append(sr.middlewares, middlewares...)
}
func PathParam(r *http.Request, key string) string {
	pathParams, ok := r.Context().Value(pathParamsKey).(map[string]string)
	if !ok {
		return ""
	}
	val, ok := pathParams[key]
	if !ok {
		return ""
	}
	return val
}
func (sr *OpenAPIMux) handleRequest(w http.ResponseWriter, r *http.Request) {
	_, route, pathParams, e := sr.Routers.FindRoute(r)
	if route == nil || route.Operation == nil || route.Operation.OperationID == "" || e != nil {
		sr.ErrorHandler(w, r, "Path not found", http.StatusNotFound)
		return
	}
	handler, ok := sr.handlers[route.Operation.OperationID]
	if ok == false {
		sr.ErrorHandler(w, r, "Handler not found", http.StatusMethodNotAllowed)
		return
	}
	input := &openapi3filter.RequestValidationInput{
		Request:    r,
		PathParams: pathParams,
		Route:      route,
	}
	e = openapi3filter.ValidateRequest(r.Context(), input)
	if e != nil {
		openapi3.SchemaErrorDetailsDisabled = !sr.DetailedError
		userError := e.Error()
		if !sr.DetailedError {
			userError = "Invalid Request"
		}
		sr.ErrorHandler(w, r, userError, http.StatusBadRequest)
		return
	}
	handler.ServeHTTP(w, WithPathParams(r, pathParams))
}