prop_string: Character (string) S7 property

View source: R/02_S7_prop_factories.R

prop_stringR Documentation

Character (string) S7 property

Description

Empty and whitespace-only strings are rejected by default: an unset value is NULL, so "" reaching a property is almost always a mistake rather than a deliberate empty name. Pass allow_empty = TRUE where it is meaningful.

Usage

prop_string(
  default = NULL,
  enum = NULL,
  nullable = FALSE,
  vector = FALSE,
  map = FALSE,
  min_items = 1L,
  unique_items = FALSE,
  allow_empty = FALSE,
  description = ""
)

Arguments

default

Character: Default value (NULL for none, or if nullable).

enum

Character or NULL: Allowed values.

nullable

Logical: If TRUE, NULL is a valid value.

vector

Logical: If TRUE, the value is vector-valued (a JSON array).

map

Logical: If TRUE, the value is a named vector (a JSON object with string values). Mutually exclusive with vector.

min_items

Integer: Fewest elements a vector or map value may hold.

unique_items

Logical: If TRUE, a vector value's elements must be distinct.

allow_empty

Logical: If TRUE, "" is a valid value.

description

Character: Human-readable description.

Value

S7 property.

Author(s)

EDG

Examples

model_name <- prop_string(description = "Model name")
backend <- prop_string(default = "ollama", enum = c("ollama", "openai"))
api_key <- prop_string(nullable = TRUE, description = "API key")

rtemis.core documentation built on Sept. 20, 2026, 9:06 a.m.