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:
parent
c631006303
commit
024b19b830
|
|
@ -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 =>
|
||||||
|
|
|
||||||
|
|
@ -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))
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue