text_slots

datamodel.text_slots

A text slot holds text: a structured value written where the schema declares a string is refused, not stringified.

LinkML’s generated dataclasses coerce a non-str value in a string slot, or in an identifier slot typed by an extended_str subclass, with str(), which stores a mapping as the text "JsonObj(value=...)" and lets it surface later as an axis label or a name nobody wrote. hatch_build.py routes every such coercion through :func:text_value, which passes text and scalars on to str() and raises for anything with structure. The Pydantic models refuse these values too, so both construction paths agree.

Functions

Name Description
text_value value unchanged when str() renders it as the text it stands for; a TypeError naming Class.slot when it carries structure.

text_value

datamodel.text_slots.text_value(owner, slot, value)

value unchanged when str() renders it as the text it stands for; a TypeError naming Class.slot when it carries structure.

Structure is a mapping, a sequence other than text, a set, an iterator, an array with at least one dimension, or a record. An enum member is a scalar despite descending from both YAMLRoot and JsonObj: its str() is its permissible value’s text. So are numbers, booleans, paths and symbolic expressions.