Skip to content

Commit c0c02fd

Browse files
ericchiangk8s-publishing-bot
authored andcommitted
remove OpenAPI import from types
Kubernetes-commit: eb0ac60175d50340a11fdb731b2c3320f92d4993
1 parent d863998 commit c0c02fd

File tree

7 files changed

+36
-58
lines changed

7 files changed

+36
-58
lines changed

pkg/api/resource/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,9 @@ go_library(
3838
],
3939
importpath = "k8s.io/apimachinery/pkg/api/resource",
4040
deps = [
41-
"//vendor/github.com/go-openapi/spec:go_default_library",
4241
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
4342
"//vendor/github.com/spf13/pflag:go_default_library",
4443
"//vendor/gopkg.in/inf.v0:go_default_library",
45-
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
4644
],
4745
)
4846

pkg/api/resource/quantity.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,7 @@ import (
2727

2828
flag "github.com/spf13/pflag"
2929

30-
"github.com/go-openapi/spec"
3130
inf "gopkg.in/inf.v0"
32-
openapi "k8s.io/kube-openapi/pkg/common"
3331
)
3432

3533
// Quantity is a fixed-point representation of a number.
@@ -399,17 +397,15 @@ func (q Quantity) DeepCopy() Quantity {
399397
return q
400398
}
401399

402-
// OpenAPIDefinition returns openAPI definition for this type.
403-
func (_ Quantity) OpenAPIDefinition() openapi.OpenAPIDefinition {
404-
return openapi.OpenAPIDefinition{
405-
Schema: spec.Schema{
406-
SchemaProps: spec.SchemaProps{
407-
Type: []string{"string"},
408-
Format: "",
409-
},
410-
},
411-
}
412-
}
400+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
401+
// the OpenAPI spec of this type.
402+
//
403+
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
404+
func (_ Quantity) OpenAPISchemaType() []string { return []string{"string"} }
405+
406+
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
407+
// the OpenAPI spec of this type.
408+
func (_ Quantity) OpenAPISchemaFormat() string { return "" }
413409

414410
// CanonicalizeBytes returns the canonical form of q and its suffix (see comment on Quantity).
415411
//

pkg/apis/meta/v1/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ go_library(
5353
],
5454
importpath = "k8s.io/apimachinery/pkg/apis/meta/v1",
5555
deps = [
56-
"//vendor/github.com/go-openapi/spec:go_default_library",
5756
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
5857
"//vendor/github.com/gogo/protobuf/sortkeys:go_default_library",
5958
"//vendor/github.com/google/gofuzz:go_default_library",
@@ -67,7 +66,6 @@ go_library(
6766
"//vendor/k8s.io/apimachinery/pkg/types:go_default_library",
6867
"//vendor/k8s.io/apimachinery/pkg/util/intstr:go_default_library",
6968
"//vendor/k8s.io/apimachinery/pkg/watch:go_default_library",
70-
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
7169
],
7270
)
7371

pkg/apis/meta/v1/micro_time.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ import (
2020
"encoding/json"
2121
"time"
2222

23-
openapi "k8s.io/kube-openapi/pkg/common"
24-
25-
"github.com/go-openapi/spec"
2623
"github.com/google/gofuzz"
2724
)
2825

@@ -149,16 +146,15 @@ func (t MicroTime) MarshalJSON() ([]byte, error) {
149146
return json.Marshal(t.UTC().Format(RFC3339Micro))
150147
}
151148

152-
func (_ MicroTime) OpenAPIDefinition() openapi.OpenAPIDefinition {
153-
return openapi.OpenAPIDefinition{
154-
Schema: spec.Schema{
155-
SchemaProps: spec.SchemaProps{
156-
Type: []string{"string"},
157-
Format: "date-time",
158-
},
159-
},
160-
}
161-
}
149+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
150+
// the OpenAPI spec of this type.
151+
//
152+
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
153+
func (_ MicroTime) OpenAPISchemaType() []string { return []string{"string"} }
154+
155+
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
156+
// the OpenAPI spec of this type.
157+
func (_ MicroTime) OpenAPISchemaFormat() string { return "date-time" }
162158

163159
// MarshalQueryParameter converts to a URL query parameter value
164160
func (t MicroTime) MarshalQueryParameter() (string, error) {

pkg/apis/meta/v1/time.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ import (
2020
"encoding/json"
2121
"time"
2222

23-
openapi "k8s.io/kube-openapi/pkg/common"
24-
25-
"github.com/go-openapi/spec"
2623
"github.com/google/gofuzz"
2724
)
2825

@@ -151,16 +148,15 @@ func (t Time) MarshalJSON() ([]byte, error) {
151148
return json.Marshal(t.UTC().Format(time.RFC3339))
152149
}
153150

154-
func (_ Time) OpenAPIDefinition() openapi.OpenAPIDefinition {
155-
return openapi.OpenAPIDefinition{
156-
Schema: spec.Schema{
157-
SchemaProps: spec.SchemaProps{
158-
Type: []string{"string"},
159-
Format: "date-time",
160-
},
161-
},
162-
}
163-
}
151+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
152+
// the OpenAPI spec of this type.
153+
//
154+
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
155+
func (_ Time) OpenAPISchemaType() []string { return []string{"string"} }
156+
157+
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
158+
// the OpenAPI spec of this type.
159+
func (_ Time) OpenAPISchemaFormat() string { return "date-time" }
164160

165161
// MarshalQueryParameter converts to a URL query parameter value
166162
func (t Time) MarshalQueryParameter() (string, error) {

pkg/util/intstr/BUILD

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,9 @@ go_library(
2222
],
2323
importpath = "k8s.io/apimachinery/pkg/util/intstr",
2424
deps = [
25-
"//vendor/github.com/go-openapi/spec:go_default_library",
2625
"//vendor/github.com/gogo/protobuf/proto:go_default_library",
2726
"//vendor/github.com/golang/glog:go_default_library",
2827
"//vendor/github.com/google/gofuzz:go_default_library",
29-
"//vendor/k8s.io/kube-openapi/pkg/common:go_default_library",
3028
],
3129
)
3230

pkg/util/intstr/intstr.go

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,6 @@ import (
2424
"strconv"
2525
"strings"
2626

27-
openapi "k8s.io/kube-openapi/pkg/common"
28-
29-
"github.com/go-openapi/spec"
3027
"github.com/golang/glog"
3128
"github.com/google/gofuzz"
3229
)
@@ -120,16 +117,15 @@ func (intstr IntOrString) MarshalJSON() ([]byte, error) {
120117
}
121118
}
122119

123-
func (_ IntOrString) OpenAPIDefinition() openapi.OpenAPIDefinition {
124-
return openapi.OpenAPIDefinition{
125-
Schema: spec.Schema{
126-
SchemaProps: spec.SchemaProps{
127-
Type: []string{"string"},
128-
Format: "int-or-string",
129-
},
130-
},
131-
}
132-
}
120+
// OpenAPISchemaType is used by the kube-openapi generator when constructing
121+
// the OpenAPI spec of this type.
122+
//
123+
// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators
124+
func (_ IntOrString) OpenAPISchemaType() []string { return []string{"string"} }
125+
126+
// OpenAPISchemaFormat is used by the kube-openapi generator when constructing
127+
// the OpenAPI spec of this type.
128+
func (_ IntOrString) OpenAPISchemaFormat() string { return "int-or-string" }
133129

134130
func (intstr *IntOrString) Fuzz(c fuzz.Continue) {
135131
if intstr == nil {

0 commit comments

Comments
 (0)