| S7_to_JSONSchema | R Documentation |
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 because everything it derives from is published, the
second because it has no wire form at all. A spec-less property with no role
is an error, so a class that drifts from the factory vocabulary fails schema
generation.
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
)
x |
S7 class (e.g. |
id |
Character: Schema |
title |
Character: Schema title. Defaults to the class name. |
description |
Character: Schema description. If empty, the "description" keyword is omitted from the schema. |
base |
S7 class or NULL: The family base class, whose inherited
properties are machinery ( |
required |
Character: Names of required properties. Default NULL: all
optional, so omitted fields fall back to their |
record |
Logical: If TRUE, emit the record form of the schema: the
same properties, but every one required. A record states what a run
actually used, so nothing in it may fall back to a reader's defaults – an
unset value is written as an explicit |
asserted |
Logical: If TRUE, emit an assertion schema: the input
form, but with every property required. For a results class – a document
rtemis produces rather than one a caller authors, and which has no record
sibling to carry the requirement. The config contract's reason for omitting
|
provenance_url |
Character or NULL: If set (and |
session_url |
Character or NULL: If set (and |
fold_refs |
Named character or NULL: If set (and |
metrics_refs |
Named character or NULL: If set (and |
metrics_ref |
Character or NULL: If set (and |
reference_urls |
Optional named character: Publication URLs keyed by qualified class identity. If omitted, derived from the package catalog. |
closed |
Logical: If TRUE (default) the schema sets
|
instance_schema_url |
Character or NULL: If set, adds a |
Named list: the JSON Schema. Serialize with write_JSONSchema.
EDG
## Not run:
schema <- S7_to_JSONSchema(
LightRFHyperparameters,
id = "https://schema.rtemis.org/hyperparameters/r/lightrf/v1/schema.json",
base = Hyperparameters
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.