schema.resourceschema.md

October 26, 2023 ยท View on GitHub

Home > @datashaper/schema > ResourceSchema

ResourceSchema interface

Parent class for any resource type understood by the system. Any object type that extends from Resource is expected to have a standalone schema published. For project state, this can be left as generic as possible for now.

Signature:

export interface ResourceSchema extends Named 

Extends: Named

Properties

PropertyModifiersTypeDescription
$schema?string(Optional) The JSON schema for this resource.
homepage?string(Optional) URL to a public webpage that describes this resource.
license?string(Optional) SPDX license string. https://spdx.org/licenses/
path?string | string[](Optional) URI-compliant path to the resource (local or remote). If array-valued, this points to a list of files that comprise the dataset (e.g., for splitting very large tables). URI-compliant path to the referenced resource (local or remote).
profile?Profile(Optional) Defines the resource type. Known resource types should have accompanying processors and rendering components. Unknown resource types can be interrogated to determine if the format is understandable by an existing component. Note that this could be inferred from $schema, but a simple string here is easier to deal with in code.
rel?Rel | string

(Optional) The relationship of this resource to the parent resource.

Note: If the resource is a profile-free reference object (e.g. { "rel": "input", "path": "path/to/datatable.json" },

Then the relationship is _external_ the target resource and should not be persisted in the object )

sources?(string | ResourceSchema)[](Optional) List of resources that underlie this resource. This gives us the ability to create hierarchical or linked structures to represent complex combinations. For example, a parent resource can have source tables, a workflow, and a table schema that all combine to create a fully-realized, strongly typed, and transformed output table. Entire Resource objects may be embedded here, or a string path to the Resource definition JSON.