/ rules / D-SCHEMA-01.py
D-SCHEMA-01.py
 1  """
 2  Rule: D-SCHEMA-01 - supported entry version
 3  Type: semantic | Output: binary
 4  Description: Reject when entry.version is unsupported.
 5  Spec reference: 8.1.1
 6  """
 7  
 8  # TODO: Implement supported entry version check
 9  # Input: NIP-35 event dict with tags field
10  # Output: {"passed": bool}
11  #
12  # Steps:
13  #   1. Extract 'v' tag value from tags
14  #   2. Compare against supported version list (currently only "1" is supported per NIP-35)
15  #   3. Return {"passed": False} if version is not "1"
16  #   4. Return {"passed": True} if version is "1"
17  #
18  # Edge cases:
19  #   - Missing 'v' tag (reject as unsupported)
20  #   - Multiple 'v' tags (take first occurrence)
21  #   - Empty version string (reject as unsupported)
22  #
23  # Dependencies: None (stdlib only)
24  # Estimated complexity: Low (10-15) lines
25  # Priority: High (foundational schema validation)
26  
27  from simple_types import BinaryRuleResult, Nip35Kind2003Event
28  
29  
30  def main(entry: Nip35Kind2003Event) -> BinaryRuleResult:
31      """Placeholder: deterministic pass-through."""
32      return {"passed": True}