Custom Attributes (attr)
While Scapius provides a comprehensive set of built-in properties, enterprise architecture teams frequently need to record bespoke metadata, FinOps cost codes, compliance identifiers, and cloud provider tags.
The attr keyword allows defining namespaced key-value pairs on any entity or relationship.
Syntax
attr (<namespace>:)*<attribute_name> <value>
- Namespace (optional):
snake_caseprefix indicating the domain (e.g.aws,finops,sec,k8s). - Attribute Name:
snake_caseidentifier. - Value: String (
"value"), Boolean (true/false), or Numeric literal (123,99.9).
Usage on Entities
system sys_order_router "Order Router" {
# Custom cloud metadata
attr aws:account_id "123456789012"
attr aws:region "us-east-1"
# FinOps metadata
attr finops:cost_center "CC-9012"
attr finops:chargeback_enabled true
# Custom security categorization
attr sec:cmdb_id "CMDB-SYS-4410"
attr sec:critical_infrastructure true
}
Usage on Relationships
Custom attributes can also be attached to relationship property blocks:
sys_order_router flows_to sys_warehouse "Transfers packing slips" {
attr net:protocol "mTLS"
attr net:port 8443
attr kafka:topic "orders.fulfillment.v1"
}
Best Practices for Namespaces
| Namespace Prefix | Recommended Usage | Example |
|---|---|---|
cloud: / aws: / azure: | Cloud provider runtime metadata | attr cloud:vpc "vpc-0a81" |
finops: | Cost centers, chargeback allocations | attr finops:cost_center "CORP-IT" |
sec: | Security classifications & CMDB tags | attr sec:data_steward "Jane Doe" |
arch: | Architecture review board tracking | attr arch:arb_approval_date "2026-04-01" |
Querying Custom Attributes in Views & Styles
Custom attributes are first-class query targets in view where clauses and style rule predicates using the attr.<namespace:attribute_name> syntax:
views {
landscape cloud_landscape "US-East AWS Landscape" {
# Filter entities matching custom attribute queries
include system where attr.aws:region == "us-east-1"
exclude system where attr.finops:chargeback_enabled == false
# Apply predicate-based conditional styling to custom attributes
style system where attr.sec:critical_infrastructure == true {
css_class "critical-border"
}
}
}
The predicate evaluator automatically infers and resolves attribute types (string, boolean, or numeric) and supports equality (==, !=), string matching (contains, starts_with, ends_with), and comparison operators (>, <, >=, <=).
Strict Attribute Type Declarations (types)
To enforce schema consistency and validation across a workspace, custom attributes can be strictly declared in a root types { ... } block:
workspace enterprise_workspace "Enterprise Model" {
types {
attr_type aws:region "string"
attr_type finops:cost_center "string"
attr_type pci:level "number"
attr_type finops:chargeback_enabled "bool"
attr_type cloud:provider "enum" {
values ["aws", "azure", "gcp"]
}
}
# Entities using these attributes are strictly validated at compile time
system sys_payments "Payments Engine" {
attr cloud:provider "aws"
attr pci:level 1
attr finops:chargeback_enabled true
}
}
Supported Attribute Types
"string": String literals (e.g."us-east-1")."number": Numbers, including floating point and signed/negative numbers (e.g.1,-10.5)."bool": Booleans (true,false)."enum": Restricted to a defined allowlist via{ values ["...", "..."] }.
When an attribute is declared with attr_type:
- Any usage of the attribute with an incompatible value type produces a compiler diagnostic (
NEA2039for string expected,NEA2040for number expected,NEA2041for bool expected,NEA2042for unknown enum value). - Predicates in view
include/excludeand style rules are strictly type checked (e.g. comparison operators<,>,<=,>=are restricted to"number"attributes).