func BuildOpenAPIDefinitionsForResource(model interface{}, config *common.Config) (*spec.Definitions, error) {
	o := newOpenAPI(config)
	_, err := o.toSchema(util.GetCanonicalTypeName(model))
	if err != nil {
		return nil, err
	}
	swagger, err := o.finalizeSwagger()
	if err != nil {
		return nil, err
	}
	return &swagger.Definitions, nil
}
BuildOpenAPIDefinitionsForResource builds a partial OpenAPI spec given a sample object and common.Config to customize it.
package builder
import (
	"encoding/json"
	"fmt"
	"net/http"
	"strings"
	restful "github.com/emicklei/go-restful"
	"k8s.io/kube-openapi/pkg/common"
	"k8s.io/kube-openapi/pkg/util"
	"k8s.io/kube-openapi/pkg/validation/spec"
)
const (
	OpenAPIVersion = "2.0"
)
type openAPI struct {
	config       *common.Config
	swagger      *spec.Swagger
	protocolList []string
	definitions  map[string]common.OpenAPIDefinition
}
func BuildOpenAPISpec(webServices []*restful.WebService, config *common.Config) (*spec.Swagger, error) {
	o := newOpenAPI(config)
	err := o.buildPaths(webServices)
	if err != nil {
		return nil, err
	}
	return o.finalizeSwagger()
}