mirror of https://github.com/k3s-io/k3s
manually fix openapi-gen
parent
239613b521
commit
4379bbdafb
|
@ -20,17 +20,17 @@ import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
"sort"
|
||||||
"strings"
|
"strings"
|
||||||
"unicode"
|
"unicode"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
restful "github.com/emicklei/go-restful"
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
"k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/runtime"
|
"k8s.io/apimachinery/pkg/runtime"
|
||||||
"k8s.io/apimachinery/pkg/runtime/schema"
|
"k8s.io/apimachinery/pkg/runtime/schema"
|
||||||
"k8s.io/apiserver/pkg/util/trie"
|
"k8s.io/apiserver/pkg/util/trie"
|
||||||
"sort"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var verbs = trie.New([]string{"get", "log", "read", "replace", "patch", "delete", "deletecollection", "watch", "connect", "proxy", "list", "create", "patch"})
|
var verbs = trie.New([]string{"get", "log", "read", "replace", "patch", "delete", "deletecollection", "watch", "connect", "proxy", "list", "create", "patch"})
|
||||||
|
@ -139,7 +139,11 @@ func friendlyName(name string) string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func typeName(t reflect.Type) string {
|
func typeName(t reflect.Type) string {
|
||||||
return fmt.Sprintf("%s.%s", t.PkgPath(), t.Name())
|
path := t.PkgPath()
|
||||||
|
if strings.Contains(path, "/vendor/") {
|
||||||
|
path = path[strings.Index(path, "/vendor/")+len("/vendor/"):]
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("%s.%s", path, t.Name())
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewDefinitionNamer constructs a new DefinitionNamer to be used to customize OpenAPI spec.
|
// NewDefinitionNamer constructs a new DefinitionNamer to be used to customize OpenAPI spec.
|
||||||
|
|
|
@ -24,7 +24,7 @@ import (
|
||||||
"reflect"
|
"reflect"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/emicklei/go-restful"
|
restful "github.com/emicklei/go-restful"
|
||||||
"github.com/go-openapi/spec"
|
"github.com/go-openapi/spec"
|
||||||
|
|
||||||
"k8s.io/apimachinery/pkg/openapi"
|
"k8s.io/apimachinery/pkg/openapi"
|
||||||
|
|
Loading…
Reference in New Issue