diff options
Diffstat (limited to 'vendor/github.com/xeipuuv/gojsonschema/locales.go')
-rw-r--r-- | vendor/github.com/xeipuuv/gojsonschema/locales.go | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/vendor/github.com/xeipuuv/gojsonschema/locales.go b/vendor/github.com/xeipuuv/gojsonschema/locales.go index ee41484a7..9b4570f01 100644 --- a/vendor/github.com/xeipuuv/gojsonschema/locales.go +++ b/vendor/github.com/xeipuuv/gojsonschema/locales.go @@ -36,16 +36,19 @@ type ( NumberNot() string MissingDependency() string Internal() string + Const() string Enum() string ArrayNotEnoughItems() string ArrayNoAdditionalItems() string ArrayMinItems() string ArrayMaxItems() string Unique() string + ArrayContains() string ArrayMinProperties() string ArrayMaxProperties() string AdditionalPropertyNotAllowed() string InvalidPropertyPattern() string + InvalidPropertyName() string StringGTE() string StringLTE() string DoesNotMatchPattern() string @@ -76,6 +79,9 @@ type ( HttpBadStatus() string ParseError() string + ConditionThen() string + ConditionElse() string + // ErrorFormat ErrorFormat() string } @@ -116,6 +122,10 @@ func (l DefaultLocale) Internal() string { return `Internal Error {{.error}}` } +func (l DefaultLocale) Const() string { + return `{{.field}} does not match: {{.allowed}}` +} + func (l DefaultLocale) Enum() string { return `{{.field}} must be one of the following: {{.allowed}}` } @@ -137,7 +147,11 @@ func (l DefaultLocale) ArrayMaxItems() string { } func (l DefaultLocale) Unique() string { - return `{{.type}} items must be unique` + return `{{.type}} items[{{.i}},{{.j}}] must be unique` +} + +func (l DefaultLocale) ArrayContains() string { + return `At least one of the items must match` } func (l DefaultLocale) ArrayMinProperties() string { @@ -156,6 +170,10 @@ func (l DefaultLocale) InvalidPropertyPattern() string { return `Property "{{.property}}" does not match pattern {{.pattern}}` } +func (l DefaultLocale) InvalidPropertyName() string { + return `Property name of "{{.property}}" does not match` +} + func (l DefaultLocale) StringGTE() string { return `String length must be greater than or equal to {{.min}}` } @@ -268,14 +286,23 @@ func (l DefaultLocale) ErrorFormat() string { //Parse error func (l DefaultLocale) ParseError() string { - return `Expected: %expected%, given: Invalid JSON` + return `Expected: {{.expected}}, given: Invalid JSON` +} + +//If/Else +func (l DefaultLocale) ConditionThen() string { + return `Must validate "then" as "if" was valid` +} + +func (l DefaultLocale) ConditionElse() string { + return `Must validate "else" as "if" was not valid` } const ( STRING_NUMBER = "number" STRING_ARRAY_OF_STRINGS = "array of strings" STRING_ARRAY_OF_SCHEMAS = "array of schemas" - STRING_SCHEMA = "schema" + STRING_SCHEMA = "valid schema" STRING_SCHEMA_OR_ARRAY_OF_STRINGS = "schema or array of strings" STRING_PROPERTIES = "properties" STRING_DEPENDENCY = "dependency" |