Skip to content

Type Alias: FeatureValueDto

@kortexya/reasoninglayer


@kortexya/reasoninglayer / FeatureValueDto

FeatureValueDto = VariableFeatureValue | LiteralFeatureValue | InlineTermFeatureValue | SortRefFeatureValue | TermRefFeatureValue | string | number | boolean | null | FeatureValueDto[]

Defined in: src/types/values.ts:775

Untagged value type used by homoiconic inference endpoints.

Serialization format: Untagged (raw JSON primitives).

Produces raw JSON values: "hello", 42, true, null, ["uuid1", "uuid2"]. Used by: backward chaining, forward chaining, and other homoiconic inference endpoints. Do NOT use with term CRUD or query endpoints — use ValueDto instead.

The backend Rust type is FeatureValueDto in dto/homoiconic.rs with #[serde(untagged)]. Variant ordering — load-bearing, because an untagged union tries its variants in declaration order and an object with extra keys still matches an earlier variant that ignores them:

  1. Variable ({term_id, var_name})
  2. Literal ({term_id, literal})
  3. Term (a whole wire Ψ-term {term_id, sort_id, sort_name, features, display})
  4. SortRef ({sort_ref, sort_name?})
  5. TermRef ({term_id})
  6. TermRefs/List (array of FeatureValueDto)
  7. String
  8. Integer (i64)
  9. Real (f64)
  10. Boolean
  11. Null (uninstantiated)

A sort named as a value (domain Value::SortId) used to arrive as a bare TermRefFeatureValue carrying the sort’s id, which GET /terms/{id} answered 404 for. It now arrives as a SortRefFeatureValue.

Values arrive exactly as the engine sends them (snake_case keys). To send a listed value back on a write — rebuilding a rule from getRules() — convert it with featureValueToInput().

Ambiguity note: UUID strings and regular strings are both string in TypeScript. The backend distinguishes them by UUID format. The SDK provides discriminateFeatureValue() in utils/discrimination.ts for response parsing.