mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-09-26 12:46:06 +00:00
Strip defaults in new places
This commit is contained in:
@@ -42,5 +42,6 @@ go_test(
|
||||
deps = [
|
||||
"//staging/src/k8s.io/apimachinery/pkg/util/diff:go_default_library",
|
||||
"//vendor/github.com/go-openapi/spec:go_default_library",
|
||||
"//vendor/k8s.io/kube-openapi/pkg/handler:go_default_library",
|
||||
],
|
||||
)
|
||||
|
@@ -24,12 +24,15 @@ import (
|
||||
"github.com/go-openapi/spec"
|
||||
|
||||
"k8s.io/apimachinery/pkg/util/diff"
|
||||
"k8s.io/kube-openapi/pkg/handler"
|
||||
)
|
||||
|
||||
func TestOpenAPIRoundtrip(t *testing.T) {
|
||||
dummyRef := func(name string) spec.Ref { return spec.MustCreateRef("#/definitions/dummy") }
|
||||
for name, value := range GetOpenAPIDefinitions(dummyRef) {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
// TODO(kubernetes/gengo#193): We currently round-trip ints to floats.
|
||||
value.Schema = *handler.PruneDefaultsSchema(&value.Schema)
|
||||
data, err := json.Marshal(value.Schema)
|
||||
if err != nil {
|
||||
t.Error(err)
|
||||
|
Reference in New Issue
Block a user