Code change:
}, }, }, <del> map[string]interface{}{"field": map[string]interface{}{}}, }, false}, {"!nullable against null", args{ apiextensions.JSONSchemaProps{ Properties: map[string]apiextensions.JSONSchemaProps{ "field": { Type:     "object", Nullable: false, }, }, </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": map[string]interface{}{}}, </ins> }, <del> map[string]interface{}{"field": nil}, }, true}, {"!nullable against undefined", args{ apiextensions.JSONSchemaProps{ </del> <ins> failingObjects: []interface{}{ map[string]interface{}{"field": "foo"}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "nullable", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { Type:     "object", <del> Nullable: false, </del> <ins> Nullable: true, </ins> }, }, }, <del> map[string]interface{}{}, }, false}, {"nullable against non-null", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": nil}, }, failingObjects: []interface{}{ map[string]interface{}{"field": "foo"}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "nullable and no type", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { <del> Type:     "object", </del> Nullable: true, }, }, }, <del> map[string]interface{}{"field": map[string]interface{}{}}, }, false}, {"nullable against null", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": nil}, map[string]interface{}{"field": "foo"}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "x-kubernetes-int-or-string", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { <del> Type:     "object", Nullable: true, </del> <ins> XIntOrString: true, </ins> }, }, }, <del> map[string]interface{}{"field": nil}, }, false}, {"!nullable against undefined", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": "foo"}, }, failingObjects: []interface{}{ map[string]interface{}{"field": nil}, map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "nullable and x-kubernetes-int-or-string", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { <del> Type:     "object", Nullable: true, </del> <ins> Nullable:     true, XIntOrString: true, </ins> }, }, }, <del> map[string]interface{}{}, }, false}, {"nullable and no type against non-nil", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": "foo"}, map[string]interface{}{"field": nil}, }, failingObjects: []interface{}{ map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "nullable, x-kubernetes-int-or-string and user-provided anyOf", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { <del> Nullable: true, </del> <ins> Nullable:     true, XIntOrString: true, AnyOf: []apiextensions.JSONSchemaProps{ {Type: "integer"}, {Type: "string"}, }, </ins> }, }, }, <del> map[string]interface{}{"field": 42}, }, false}, {"nullable and no type against nil", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": nil}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": "foo"}, }, failingObjects: []interface{}{ map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "nullable, x-kubernetes-int-or-string and user-provider allOf", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { <del> Nullable: true, </del> <ins> Nullable:     true, XIntOrString: true, AllOf: []apiextensions.JSONSchemaProps{ { AnyOf: []apiextensions.JSONSchemaProps{ {Type: "integer"}, {Type: "string"}, }, }, }, </ins> }, }, }, <del> map[string]interface{}{"field": nil}, }, false}, {"invalid regex", args{ apiextensions.JSONSchemaProps{ </del> <ins> objects: []interface{}{ map[string]interface{}{}, map[string]interface{}{"field": nil}, map[string]interface{}{"field": 42}, map[string]interface{}{"field": "foo"}, }, failingObjects: []interface{}{ map[string]interface{}{"field": true}, map[string]interface{}{"field": 1.2}, map[string]interface{}{"field": map[string]interface{}{}}, map[string]interface{}{"field": []interface{}{}}, }, }, {name: "invalid regex", schema: apiextensions.JSONSchemaProps{ </ins> Properties: map[string]apiextensions.JSONSchemaProps{ "field": { Type:    "string",

Related discussion:
text: The server-side validation does not check the type of values with . Create a CRD like: Then create a CR: It is not rejected, but should because must not be a boolean.