Add data handling and test isolation guidance

- add SCM guidance for deriving base quantities through line unit-of-measure validation`n- add security guidance for parameterizing SetFilter with external text`n- add test isolation guidance for resetting per-test state before initialization guards`n- add web-service guidance for JSON null handling and invariant standard format 9`n- route and cover all five rules with paired evaluation fixtures
This commit is contained in:
demiliani 2026-09-23 17:09:24 +02:00
parent 45ca57a23e
commit 570e776a37
20 changed files with 508 additions and 6 deletions

View file

@ -0,0 +1,28 @@
codeunit 50172 "Contact Payload Reader Good"
{
procedure ApplyPayload(var Contact: Record Contact; Payload: JsonObject)
var
EmailAddress: Text;
begin
if TryGetText(Payload, 'email', EmailAddress) then
Contact.Validate("E-Mail", CopyStr(EmailAddress, 1, MaxStrLen(Contact."E-Mail")));
Contact.Modify(true);
end;
local procedure TryGetText(Payload: JsonObject; PropertyName: Text; var Value: Text): Boolean
var
Token: JsonToken;
begin
if not Payload.Get(PropertyName, Token) then
exit(false);
if not Token.IsValue() then
Error(NotAValueErr, PropertyName);
if Token.AsValue().IsNull() then
exit(false);
Value := Token.AsValue().AsText();
exit(true);
end;
var
NotAValueErr: Label 'The property %1 must contain a single value.', Comment = '%1 = JSON property name';
}