smithery/treasure-data

validate-segment

Validation reference for CDP segment YAML.

Installation

$ npx skills add smithery/treasure-data --skill validate-segment

Summary

  • Validation reference for CDP segment YAML.
  • Lists all 18 operator types, required fields, and error codes.
  • Use alongside the **segment** skill when troubleshooting validation errors from `tdx sg validate` or `tdx sg push --dry-run`, checking operator syntax, or verifying behavior condition structure.

Similar popular skills

Related neighbors and high-traction skills in the same topics — useful to compare before installing.

Also in this package

Other skills from smithery/treasure-data · top by installs.

npx skills add smithery/treasure-data

Browse all from smithery/treasure-data

More details

Agent compatibility

Declared targets from SKILL.md / docs. Unmarked agents are not listed — the skill may still install via the CLI.

Claude Code Not declared
Cursor Not declared
Codex Not declared
GitHub Copilot Not declared
Windsurf Not declared
Gemini CLI Not declared
Cline Not declared
OpenCode Not declared

Package contents

Files included with this skill beyond the listing page.

  • skill md SKILL.md 5,576 B
  • docs SUMMARY.md 270 B

History

  1. First recorded snapshot · 0 installs

SKILL.md

Segment YAML Validation

Validate one segment at a time. Always specify the file path explicitly:

tdx sg validate path/to/segment.yml       # Local validation (fast, catches syntax errors)
tdx sg push --dry-run "path/to/segment.yml"  # Server validation (catches schema/reference errors)

Required Structure

name: string                       # Required (MISSING_NAME)
kind: batch                        # batch | realtime | funnel_stage
rule:
  type: And                        # And | Or (INVALID_RULE_TYPE)
  conditions:                      # Required array (MISSING_CONDITIONS)
    - type: Value
      attribute: field_name        # Required non-empty for Value (EMPTY_ATTRIBUTE)
      operator:
        type: OperatorType
        not: false                 # Optional negation
        value: ...

Condition Types

Type Required Fields Error Codes
Value attribute, operator EMPTYATTRIBUTE, INVALIDOPERATOR_TYPE
Value (with behavior) attribute: "", operator, source, aggregation, filter Server-side validation
include / exclude segment MISSINGSEGMENTREFERENCE
And / Or conditions MISSINGCONDITIONS, NESTEDCONDITION_GROUP

Note: For behavior queries, use type: Value with source, aggregation, and filter fields. The type: Behavior may pass local validation but fail server-side.

Operators

18 valid types — any other value triggers INVALIDOPERATORTYPE:

Category Types Required Error
Comparison Equal, NotEqual, Greater, GreaterEqual, Less, LessEqual value MISSINGOPERATORVALUE
Range Between min and/or max MISSINGBETWEENBOUNDS
Set In, NotIn value (array) MISSINGOPERATORVALUE
Text Contain, StartWith, EndWith value (string array) MISSINGOPERATORVALUE
Pattern Regexp value (string) MISSINGOPERATORVALUE
Null IsNull (none) —
Time TimeWithinPast, TimeWithinNext value + unit MISSINGOPERATORVALUE, MISSINGTIMEUNIT
Time TimeRange, TimeToday (special) —

Time Units (Singular Form Only)

year | quarter | month | week | day | hour | minute | second

Common mistake: days → day, months → month

Operator Negation

Any operator supports not: true for negation. This is separate from NotEqual/NotIn which are standalone types.

Behavior Conditions

Use type: Value with source, aggregation, and filter. Inside filter, use type: Column with column field (not type: Value with attribute). See segment skill for full examples.

Nested Condition Groups

Supported, but flagged. Nesting triggers a NESTEDCONDITIONGROUP warning, not a rejection — the segment still validates and pushes successfully. The warning exists because the Console UI's SQL preview doesn't render nested groups correctly; segment execution itself is unaffected. For same-attribute Or conditions, In is simpler and avoids the warning. See segment skill for details and workarounds.

Array Matching

Optional field on Value conditions:

arrayMatching: any                 # any | all | { atLeast: N } | { atMost: N } | { exactly: N }

Invalid keys trigger INVALIDARRAYMATCHING.

Error Code Reference

Code Cause Solution
MISSING_NAME Segment name is empty or missing Add name: field
INVALIDRULETYPE Rule type is not And or Or Check type: spelling
MISSING_CONDITIONS Rule or group has no conditions array Add conditions array
EMPTY_ATTRIBUTE Attribute is empty Provide attribute name (or "" for behavior)
INVALIDOPERATORTYPE Operator type not in the 18 valid types Check operator spelling
MISSINGOPERATORVALUE Operator requires value but it is missing Add value: field
MISSINGBETWEENBOUNDS Between has neither min nor max Add min: and/or max:
MISSINGTIMEUNIT Time operator missing unit Add unit: day (singular)
INVALIDARRAYMATCHING arrayMatching has invalid format Use any, all, or object form
MISSINGSEGMENTREFERENCE include/exclude missing segment field Add segment: with exact name
NESTEDCONDITIONGROUP Any nested Or/And condition group (warning, not a rejection) Use In operator or flatten if you want to avoid the warning
SEGMENTSCHEMAERROR Server rejected the schema Check field names (column vs attribute in filter)

Local vs Server Validation

Check tdx sg validate tdx sg push --dry-run
YAML syntax Yes Yes
Operator types Yes Yes
Required fields Yes Yes
Nested groups flagged (warning only) Yes Yes
Segment references No Yes
Behavior schema Partial Yes
Field availability No Yes

Always run both validations before pushing.

Related Skills

  • segment - Full segment rule syntax and workflow