Skip to content

Commit

Permalink
Ajustes gerais
Browse files Browse the repository at this point in the history
* Correção ddo check com JSONArray
  • Loading branch information
dliocode committed Oct 7, 2021
1 parent 9c0abc8 commit a6eb02e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
6 changes: 5 additions & 1 deletion src/core/DataValidator.JSON.pas
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,7 @@ function TDataValidatorJSON.CheckValueArray(const ACheckAll: Boolean): IDataVali
Continue;
end;

LValidatorItem.SetName(LName);
LValidatorItem.SetValue(LValueSanitizer);

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

if (LValidatorItem is TDataValidatorJSONKeyIsRequired) then
Break;

if not ACheckAll then
Break;
end
else
if (LValidatorItem is TDataValidatorJSONKeyIsOptional) or (LValidatorItem is TValidatorIsOptional) then
Break
Break;
end;

LValues := Concat(LValues, [TValueToString(LValueSanitizer)]);
Expand Down
1 change: 0 additions & 1 deletion src/validators/Validator.JSON.Key.IsOptional.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function TDataValidatorJSONKeyIsOptional.Check: IDataValidatorResult;
if FValue.IsType<TJSONPair> then
begin
LJSONPair := FValue.AsType<TJSONPair>;

R := not Assigned(LJSONPair);
end;

Expand Down
1 change: 0 additions & 1 deletion src/validators/Validator.JSON.Key.IsRequired.pas
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ function TDataValidatorJSONKeyIsRequired.Check: IDataValidatorResult;
if FValue.IsType<TJSONPair> then
begin
LJSONPair := FValue.AsType<TJSONPair>;

R := Assigned(LJSONPair);
end;

Expand Down

0 comments on commit a6eb02e

Please sign in to comment.