Function: assetSchema()
assetSchema<
C,I>(__namedParameters):object
Defined in: src/lib/assets/schema.ts:181
The schema of an asset of one kind: its header (see Asset) and its content.
Type Parameters
C
C extends object
I
I extends object
Parameters
__namedParameters
AssetSchemaOptions<C, I>
Returns
object
@type
readonly@type:string=type
$id
readonly$id:string
$schema
readonly$schema:"https://json-schema.org/draft/2020-12/schema"=SCHEMA_DIALECT
additionalProperties
readonlyadditionalProperties:false=false
properties
readonlyproperties:object
properties.@type
readonly@type:object
properties.@type.const
readonlyconst:string=type
properties.$schema
readonly$schema:object=fileSchemaUrlSchema
properties.$schema.maxLength
readonlymaxLength:2048=MAX_URL_LENGTH
properties.$schema.minLength
readonlyminLength:1=1
properties.$schema.type
readonlytype:"string"="string"
properties.author
readonlyauthor:object=assetHeaderSchema.properties.author
properties.author.anyOf
readonlyanyOf: readonly [{maxLength:100;minLength:1;type:"string"; }, {additionalProperties:false;properties: {did: {maxLength:2048;pattern:"^did:[a-z]+:[a-zA-Z0-9._:%-]+$";type:"string"; };maxLength:254;type:"string"; };handle: {maxLength:100;minLength:1;type:"string"; };homepage: {maxLength:2048;type:"string"; };name: {maxLength:100;minLength:1;type:"string"; }; };required: readonly ["name"];type:"object"; }]
properties.content
content:
C
properties.group
readonlygroup:object=assetHeaderSchema.properties.group
properties.group.maxLength
readonlymaxLength:100=MAX_ASSET_TEXT_LENGTH
properties.group.minLength
readonlyminLength:1=1
properties.group.pattern
readonlypattern: "\\S" = "\\S"
properties.group.type
readonlytype:"string"="string"
properties.id
id:
I
properties.name
readonlyname:object=assetTextSchema
properties.name.maxLength
readonlymaxLength:100=MAX_ASSET_TEXT_LENGTH
properties.name.minLength
readonlyminLength:1=1
properties.name.pattern
readonlypattern: "\\S" = "\\S"
properties.name.type
readonlytype:"string"="string"
properties.updatedAt
readonlyupdatedAt:object=assetHeaderSchema.properties.updatedAt
properties.updatedAt.pattern
readonlypattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(Z|[+-]\\d{2}:\\d{2})$" =DATE_TIME_PATTERN
properties.updatedAt.type
readonlytype:"string"="string"
properties.version
readonlyversion:object=assetHeaderSchema.properties.version
properties.version.maxLength
readonlymaxLength:20=MAX_ASSET_VERSION_LENGTH
properties.version.minLength
readonlyminLength:1=1
properties.version.type
readonlytype:"string"="string"
required
readonlyrequired: readonly ["@type","id","name","author","content"]
type
readonlytype:"object"="object"
Example
assetSchema({ name: "colour-palette", version: "2.0.0", type: "PaintCanvas/ColourPalette",
id: { type: "string", pattern: UUID_PATTERN }, content: paletteContentSchema });