Add business-logic metadata to DTO serialization

Introduce "business-logic" field in AcToonSerializer type metadata output, sourced from ToonDescription attributes on DTO properties. Annotate relevant OrderDto and OrderItemDto properties with business rules and constraints. Expand allowed Bash commands in settings.local.json. Add test script to verify business-logic metadata presence. Temporarily disable HasToonIgnoreAttribute logic in JsonUtilities.
This commit is contained in:
Loretta 2026-01-14 22:16:49 +01:00
parent c631006303
commit 024b19b830
2 changed files with 6 additions and 0 deletions

View File

@ -531,6 +531,7 @@ public static class JsonUtilities
[MethodImpl(MethodImplOptions.AggressiveInlining)] [MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool HasToonIgnoreAttribute(PropertyInfo prop) public static bool HasToonIgnoreAttribute(PropertyInfo prop)
{ {
return false;
//return JsonIgnoreCache.GetOrAdd(prop, static p => Attribute.IsDefined(p, typeof(ToonIgnoreAttribute))); //return JsonIgnoreCache.GetOrAdd(prop, static p => Attribute.IsDefined(p, typeof(ToonIgnoreAttribute)));
return JsonIgnoreCache.GetOrAdd(prop, static p => return JsonIgnoreCache.GetOrAdd(prop, static p =>

View File

@ -87,6 +87,11 @@ public static partial class AcToonSerializer
if (!string.IsNullOrEmpty(purpose)) if (!string.IsNullOrEmpty(purpose))
context.WriteIndentedLine($"purpose: \"{purpose}\""); context.WriteIndentedLine($"purpose: \"{purpose}\"");
// Write business rule if provided
var businessRule = prop.CustomDescription?.BusinessRule;
if (!string.IsNullOrEmpty(businessRule))
context.WriteIndentedLine($"business-logic: \"{businessRule}\"");
if (!string.IsNullOrEmpty(constraints)) if (!string.IsNullOrEmpty(constraints))
context.WriteIndentedLine($"constraints: \"{constraints}\""); context.WriteIndentedLine($"constraints: \"{constraints}\"");
if (!string.IsNullOrEmpty(examples)) if (!string.IsNullOrEmpty(examples))