prop_* factories to a JSON SchemaWalks the class's properties, reads each attached PropertySpec, and
assembles a draft 2020-12 JSON Schema. Which properties take part is decided
by their declared role (see prop_role()), not by a list kept here:
"config" and "state" properties are generated from their spec, state
being marked readOnly, while "computed" and "r_only" properties are
omitted: the first is derived from published fields, and the second has no
wire form. A spec-less property with no role is an error.
S7_to_JSONSchema(
x,
id,
title = NULL,
description = "",
base = NULL,
required = NULL,
record = FALSE,
asserted = FALSE,
provenance_url = NULL,
session_url = NULL,
fold_refs = NULL,
metrics_refs = NULL,
metrics_ref = NULL,
reference_urls = NULL,
closed = TRUE,
instance_schema_url = NULL
)Named list: the JSON Schema. Serialize with write_JSONSchema.
S7 class (e.g. LightRFHyperparameters).
Character: Schema $id URL
(e.g. "https://schema.rtemis.org/hyperparameters/r/lightrf/v1/schema.json").
Character: Schema title. Defaults to the class name.
Character: Schema description. If empty, the "description" keyword is omitted from the schema.
S7 class or NULL: The family base class, whose inherited
properties are machinery (tuned, resampled, the computed payload list)
and are omitted. NULL for a flat config that has no
family base.
Character: Names of required properties. Default NULL: all
optional, so omitted fields fall back to their setup_* defaults on read
(matching write_config's compaction). Ignored when record is TRUE.
Logical: If TRUE, emit the record form of the schema: the
same properties, but every one required. A record states what a run used,
so every field is present, and an unset value is written as an explicit
null. Input and record schemas have identical membership.
Logical: If TRUE, emit an assertion schema: the input
form, but with every property required. For a results class: a document
rtemis produces, with no record sibling. Mutually exclusive with
record.
Character or NULL: If set (and record is TRUE), adds
a required provenance property referencing that schema. Only a top-level
record carries it; a nested one inherits its parent's.
Character or NULL: If set (and record is TRUE), adds a
required, nullable session property referencing that schema -- the
reference to the execution graph written beside the record. Nullable
because a run can produce no session: a pipeline result records none.
Named character or NULL: If set (and record is TRUE), adds
a required folds array whose entries reference these record schemas. Only
a record of a run that fits models per resample carries one.
Named character or NULL: If set (and record is TRUE),
adds the required metrics / metrics_sd headline blocks, and references
these metrics schemas from each fold's own metrics.
Character or NULL: If set (and record is TRUE), adds a
required, nullable metrics property referencing that one schema. For a
run whose result is a single metrics object;
mutually exclusive with metrics_refs.
Optional named character: Publication URLs keyed by qualified class identity. If omitted, derived from the package catalog.
Logical: If TRUE (default) the schema sets
additionalProperties: false. Pass FALSE for a family leaf, which its
dispatcher composes into one object and closes with
unevaluatedProperties instead (see S7_dispatcher_JSONSchema).
Character or NULL: If set, adds a $schema
const property (instances self-identify, as in the config families).
EDG
if (FALSE) {
schema <- S7_to_JSONSchema(
LightRFHyperparameters,
id = "https://schema.rtemis.org/hyperparameters/r/lightrf/v1/schema.json",
base = Hyperparameters
)
}
Run the code above in your browser using DataLab