From 712cbc5a3ddcbc2680b9cb73b7ee97efb77066f0 Mon Sep 17 00:00:00 2001 From: Rafael Franzke Date: Mon, 15 Oct 2018 14:16:28 +0200 Subject: [PATCH] Add OpenAPI scheme methods for metav1.Duration --- .../k8s.io/apimachinery/pkg/apis/meta/v1/duration.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go index 2eaabf0794f..babe8a8b53b 100644 --- a/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go +++ b/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/duration.go @@ -48,3 +48,13 @@ func (d *Duration) UnmarshalJSON(b []byte) error { func (d Duration) MarshalJSON() ([]byte, error) { return json.Marshal(d.Duration.String()) } + +// OpenAPISchemaType is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +// +// See: https://github.com/kubernetes/kube-openapi/tree/master/pkg/generators +func (_ Duration) OpenAPISchemaType() []string { return []string{"string"} } + +// OpenAPISchemaFormat is used by the kube-openapi generator when constructing +// the OpenAPI spec of this type. +func (_ Duration) OpenAPISchemaFormat() string { return "" }