Skip to content

Commit a6eb02e

Browse files
committed
Ajustes gerais
* Correção ddo check com JSONArray
1 parent 9c0abc8 commit a6eb02e

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

src/core/DataValidator.JSON.pas

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ function TDataValidatorJSON.CheckValueArray(const ACheckAll: Boolean): IDataVali
263263
Continue;
264264
end;
265265

266+
LValidatorItem.SetName(LName);
266267
LValidatorItem.SetValue(LValueSanitizer);
267268

268269
LValidatorResult := LValidatorItem.Check;
@@ -275,12 +276,15 @@ function TDataValidatorJSON.CheckValueArray(const ACheckAll: Boolean): IDataVali
275276
LOK := False;
276277
LInfo.Add(LValidatorResult.Informations as IDataValidatorInformations);
277278

279+
if (LValidatorItem is TDataValidatorJSONKeyIsRequired) then
280+
Break;
281+
278282
if not ACheckAll then
279283
Break;
280284
end
281285
else
282286
if (LValidatorItem is TDataValidatorJSONKeyIsOptional) or (LValidatorItem is TValidatorIsOptional) then
283-
Break
287+
Break;
284288
end;
285289

286290
LValues := Concat(LValues, [TValueToString(LValueSanitizer)]);

src/validators/Validator.JSON.Key.IsOptional.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ function TDataValidatorJSONKeyIsOptional.Check: IDataValidatorResult;
7676
if FValue.IsType<TJSONPair> then
7777
begin
7878
LJSONPair := FValue.AsType<TJSONPair>;
79-
8079
R := not Assigned(LJSONPair);
8180
end;
8281

src/validators/Validator.JSON.Key.IsRequired.pas

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,6 @@ function TDataValidatorJSONKeyIsRequired.Check: IDataValidatorResult;
7676
if FValue.IsType<TJSONPair> then
7777
begin
7878
LJSONPair := FValue.AsType<TJSONPair>;
79-
8079
R := Assigned(LJSONPair);
8180
end;
8281

0 commit comments

Comments
 (0)