assert_description_language: Assert a published schema's descriptions are...

View source: R/schema_contract.R

assert_description_languageR Documentation

Assert a published schema's descriptions are language-independent

Description

The two prose rules of the input-schema contract, on their own: no description may name an R construct, and none may spell a value the way R does. assert_config_contract() applies both along with the rules about what a config may demand; this is the entry point for a document those do not govern – a record, or a result class whose required states what rtemis always writes.

Usage

assert_description_language(schema, id = schema[["$id"]])

Arguments

schema

Named list: The generated schema, as S7_to_JSONSchema() or S7_dispatcher_JSONSchema() returns it.

id

Character: The schema's ⁠$id⁠, used to name it in the error.

Details

Every published document is read by R, by the Rust CLI, by the browser and by a model that writes no code at all, so its prose is part of the interface rather than a comment on it. A description reading "NULL = unweighted" is correct roxygen and an invalid instruction to every reader but one, who must write null; the fix is to say what the absent value means, not to transliterate the literal.

Value

The schema, invisibly, so it can wrap a write call. Throws with class simpleError naming every offending description, so one run reports all of them rather than the first.

Author(s)

EDG

Examples

assert_description_language(
  list(
    type = "object",
    properties = list(k = list(type = "integer", description = "Clusters."))
  ),
  "https://schema.rtemis.org/example/v1/schema.json"
)

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