This commit is contained in:
mr
2026-03-18 09:17:22 +01:00
parent d1214fe622
commit 4eb112bee3

View File

@@ -183,12 +183,16 @@ func plantUMLLinkComment(link graph.GraphLink) string {
// Flat-map helpers (shared by import & export) // Flat-map helpers (shared by import & export)
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
// plantUMLSkipFields lists JSON field names that must never appear in comments. // plantUMLSkipFields lists JSON field names (root keys) that must never appear
// Checked against the root key of each dot-notation path. // in human-readable comments. All names are the actual JSON tags, not Go field names.
var plantUMLSkipFields = map[string]bool{ var plantUMLSkipFields = map[string]bool{
// identity / meta // AbstractObject — identity & audit (json tags)
"uuid": true, "name": true, "created_at": true, "updated_at": true, "id": true, "name": true, "is_draft": true, "access_mode": true, "signature": true,
"creator_id": true, "is_draft": true, "creator_id": true, "user_creator_id": true,
"creation_date": true, "update_date": true,
"updater_id": true, "user_updater_id": true,
// internal resource type identifier (AbstractResource.Type / GetType())
"type": true,
// relationships / pricing // relationships / pricing
"instances": true, "partnerships": true, "instances": true, "partnerships": true,
"allowed_booking_modes": true, "usage_restrictions": true, "allowed_booking_modes": true, "usage_restrictions": true,
@@ -200,6 +204,10 @@ var plantUMLSkipFields = map[string]bool{
"kind": true, "params": true, "kind": true, "params": true,
} }
// zeroTimeStr is the JSON representation of Go's zero time.Time value.
// encoding/json does not treat it as "empty" for omitempty, so we filter it explicitly.
const zeroTimeStr = "0001-01-01T00:00:00Z"
// plantUMLToFlatMap marshals v to JSON and flattens the resulting object into // plantUMLToFlatMap marshals v to JSON and flattens the resulting object into
// a map[string]string using dot notation for nested keys, skipping zero values // a map[string]string using dot notation for nested keys, skipping zero values
// and known meta fields. // and known meta fields.
@@ -247,7 +255,7 @@ func plantUMLFlattenJSON(m map[string]interface{}, prefix string, result map[str
result[fullKey] = "true" result[fullKey] = "true"
} }
case string: case string:
if val != "" { if val != "" && val != zeroTimeStr {
result[fullKey] = val result[fullKey] = val
} }
} }