...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15 package validate
16
17 import (
18 "k8s.io/kube-openapi/pkg/validation/errors"
19 )
20
21
22 const (
23
24
25
26 ArrayDoesNotAllowAdditionalItemsError = "array doesn't allow for additional items"
27
28
29 HasDependencyError = "%q has a dependency on %s"
30
31
32 InvalidTypeConversionError = "invalid type conversion in %s: %v "
33
34
35 MustValidateAtLeastOneSchemaError = "%q must validate at least one schema (anyOf)"
36
37
38 MustValidateOnlyOneSchemaError = "%q must validate one and only one schema (oneOf). %s"
39
40
41
42
43 MustValidateAllSchemasError = "%q must validate all the schemas (allOf)%s"
44
45
46 MustNotValidateSchemaError = "%q must not validate the schema (not)"
47 )
48
49
50 const ()
51
52 func invalidTypeConversionMsg(path string, err error) errors.Error {
53 return errors.New(errors.CompositeErrorCode, InvalidTypeConversionError, path, err)
54 }
55 func mustValidateOnlyOneSchemaMsg(path, additionalMsg string) errors.Error {
56 return errors.New(errors.CompositeErrorCode, MustValidateOnlyOneSchemaError, path, additionalMsg)
57 }
58 func mustValidateAtLeastOneSchemaMsg(path string) errors.Error {
59 return errors.New(errors.CompositeErrorCode, MustValidateAtLeastOneSchemaError, path)
60 }
61 func mustValidateAllSchemasMsg(path, additionalMsg string) errors.Error {
62 return errors.New(errors.CompositeErrorCode, MustValidateAllSchemasError, path, additionalMsg)
63 }
64 func mustNotValidatechemaMsg(path string) errors.Error {
65 return errors.New(errors.CompositeErrorCode, MustNotValidateSchemaError, path)
66 }
67 func hasADependencyMsg(path, depkey string) errors.Error {
68 return errors.New(errors.CompositeErrorCode, HasDependencyError, path, depkey)
69 }
70 func arrayDoesNotAllowAdditionalItemsMsg() errors.Error {
71 return errors.New(errors.CompositeErrorCode, ArrayDoesNotAllowAdditionalItemsError)
72 }
73
View as plain text