Merge remote-tracking branch 'origin/v2_validation_config' into v2_validation_config
# Conflicts: # service/config.go
This commit is contained in:
commit
837b8755a0
1 file changed
+5
-3
+5
-3
@@ -189,14 +189,16 @@ func (configService) validateSchema(schema entity.ConfigSchema, data map[string]
|
||||
documentLoader := gojsonschema.NewGoLoader(data)
|
||||
if result, err := gojsonschema.Validate(schemaLoader, documentLoader); err != nil {
|
||||
return false, err
|
||||
} else if result.Valid() {
|
||||
return true, nil
|
||||
} else {
|
||||
} else if len(result.Errors()) > 0 {
|
||||
desc := make(map[string]string)
|
||||
for _, value := range result.Errors() {
|
||||
desc[value.Field()] = value.Description()
|
||||
}
|
||||
return false, validationSchemaError{Description: desc}
|
||||
} else if result.Valid() {
|
||||
return true, nil
|
||||
} else {
|
||||
return false, nil
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user