Skip to main content

Built and signed on GitHub Actions

Works with
This package works with Node.js, Deno, Bun
This package works with Node.js
This package works with Deno
This package works with Bun
JSR Score94%
License
MIT
Downloads8/wk
Publisheda week ago (2.2.0)

Code generator for Activity Vocabulary APIs

Functions

f
areAllScalarTypes(
typeUris: string[],
types: Record<string, TypeSchema>
): boolean
No documentation available
f
generateVocab(
schemaDir: string,
generatedPath: string
): Promise<void>
No documentation available
f
loadSchemaFiles(dir: string): Promise<Record<string, TypeSchema>>

Loads all schema files in the directory.

Interfaces

I

The schema of a type. It is used to generate a class.

  • compactName: string

    The type name used in the compacted JSON-LD document. It is used as the value of the type field.

  • The default JSON-LD context of the type. It is used as the default context of the generated toJsonLd() method.

  • description: string

    The description of the type. It is used as the doc comment of the generated class.

  • entity: boolean

    Marks the type an entity type rather than a value type. Turning on this flag will make property accessors for the type asynchronous, so that they can load the values of the properties from the remote server.

  • extends: TypeUri

    The qualified URIs of the base type of the type (if any).

  • name: string

    The type name. It is used as the name of the generated class.

  • properties: PropertySchema[]

    The possible properties of the type.

  • typeless: boolean

    Whether the type omits @type in JSON-LD serialization. When true, the generated toJsonLd() method will not emit @type (or type in compact form) in the serialized JSON-LD. The generated fromJsonLd() method will still accept @type if present for backward compatibility.

  • uri: TypeUri

    The qualified URI of the type.

Type Aliases

T
PropertySchema =
PropertySchemaBase
& PropertySchemaTyping
& { functional?: false; pluralName: string; singularAccessor?: boolean; container?: "graph" | "list"; }

|
PropertySchemaBase
& PropertySchemaTyping
& { functional: true; redundantProperties?: { uri: string; compactName?: string; }[]; }

The schema of a property. It is used to generate property accessors of a class.

Report package

Please provide a reason for reporting this package. We will review your report and take appropriate action.

Please review the JSR usage policy before submitting a report.

Add Package

deno add jsr:@fedify/vocab-tools

Import symbol

import * as mod from "@fedify/vocab-tools";
or

Import directly with a jsr specifier

import * as mod from "jsr:@fedify/vocab-tools";