2 Copyright 2017 The Kubernetes Authors.
4 Licensed under the Apache License, Version 2.0 (the "License");
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
8 http://www.apache.org/licenses/LICENSE-2.0
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
20 "k8s.io/apimachinery/pkg/conversion"
21 "k8s.io/apimachinery/pkg/runtime"
22 "k8s.io/apimachinery/pkg/util/json"
24 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions"
27 func addConversionFuncs(scheme *runtime.Scheme) error {
28 // Add non-generated conversion functions
29 err := scheme.AddConversionFuncs(
30 Convert_apiextensions_JSONSchemaProps_To_v1beta1_JSONSchemaProps,
31 Convert_apiextensions_JSON_To_v1beta1_JSON,
32 Convert_v1beta1_JSON_To_apiextensions_JSON,
40 func Convert_apiextensions_JSONSchemaProps_To_v1beta1_JSONSchemaProps(in *apiextensions.JSONSchemaProps, out *JSONSchemaProps, s conversion.Scope) error {
41 if err := autoConvert_apiextensions_JSONSchemaProps_To_v1beta1_JSONSchemaProps(in, out, s); err != nil {
44 if in.Default != nil && *(in.Default) == nil {
47 if in.Example != nil && *(in.Example) == nil {
53 func Convert_apiextensions_JSON_To_v1beta1_JSON(in *apiextensions.JSON, out *JSON, s conversion.Scope) error {
54 raw, err := json.Marshal(*in)
62 func Convert_v1beta1_JSON_To_apiextensions_JSON(in *JSON, out *apiextensions.JSON, s conversion.Scope) error {
65 if err := json.Unmarshal(in.Raw, &i); err != nil {