| 1 |
package valuevalidation |
| 2 |
|
| 3 |
import ( |
| 4 |
"k8s.io/kube-openapi/pkg/common" |
| 5 |
"k8s.io/kube-openapi/pkg/validation/spec" |
| 6 |
) |
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
type Foo struct { |
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
StringValue string |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
NumberValue float64 |
| 29 |
|
| 30 |
|
| 31 |
|
| 32 |
|
| 33 |
ArrayValue []string |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
MapValue map[string]string |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
|
| 42 |
|
| 43 |
|
| 44 |
CELField string `json:"celField"` |
| 45 |
} |
| 46 |
|
| 47 |
|
| 48 |
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
type Foo2 struct{} |
| 53 |
|
| 54 |
func (Foo2) OpenAPIV3Definition() common.OpenAPIDefinition { |
| 55 |
return common.OpenAPIDefinition{ |
| 56 |
Schema: spec.Schema{ |
| 57 |
SchemaProps: spec.SchemaProps{ |
| 58 |
Type: []string{"object"}, |
| 59 |
}, |
| 60 |
}, |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
func (Foo2) OpenAPISchemaType() []string { |
| 65 |
return []string{"test-type"} |
| 66 |
} |
| 67 |
|
| 68 |
func (Foo2) OpenAPISchemaFormat() string { |
| 69 |
return "test-format" |
| 70 |
} |
| 71 |
|
| 72 |
|
| 73 |
|
| 74 |
|
| 75 |
|
| 76 |
|
| 77 |
|
| 78 |
type Foo3 struct{} |
| 79 |
|
| 80 |
func (Foo3) OpenAPIV3OneOfTypes() []string { |
| 81 |
return []string{"number", "string"} |
| 82 |
} |
| 83 |
func (Foo3) OpenAPISchemaType() []string { |
| 84 |
return []string{"string"} |
| 85 |
} |
| 86 |
func (Foo3) OpenAPISchemaFormat() string { |
| 87 |
return "string" |
| 88 |
} |
| 89 |
|
| 90 |
|
| 91 |
|
| 92 |
|
| 93 |
|
| 94 |
|
| 95 |
type Foo4 struct{} |
| 96 |
|
| 97 |
func (Foo4) OpenAPIDefinition() common.OpenAPIDefinition { |
| 98 |
return common.OpenAPIDefinition{ |
| 99 |
Schema: spec.Schema{ |
| 100 |
SchemaProps: spec.SchemaProps{ |
| 101 |
Type: []string{"integer"}, |
| 102 |
}, |
| 103 |
}, |
| 104 |
} |
| 105 |
} |
| 106 |
|
| 107 |
|
| 108 |
|
| 109 |
|
| 110 |
|
| 111 |
|
| 112 |
type Foo5 struct{} |
| 113 |
|
| 114 |
func (Foo5) OpenAPIV3Definition() common.OpenAPIDefinition { |
| 115 |
return common.OpenAPIDefinition{ |
| 116 |
Schema: spec.Schema{ |
| 117 |
SchemaProps: spec.SchemaProps{ |
| 118 |
Type: []string{"object"}, |
| 119 |
}, |
| 120 |
}, |
| 121 |
} |
| 122 |
} |
| 123 |
|
| 124 |
func (Foo5) OpenAPISchemaType() []string { |
| 125 |
return []string{"test-type"} |
| 126 |
} |
| 127 |
|
| 128 |
func (Foo5) OpenAPISchemaFormat() string { |
| 129 |
return "test-format" |
| 130 |
} |