Aller au contenu
En Markdown

schemas ​

Le JSON Schema de chaque standard, pour un éditeur, un formulaire ou un autre langage.

Les signatures et leurs descriptions sont en anglais, comme le code.

Exemple ​

example.mjs
js
// The JSON Schema of a document, and its problems against it (what an editor underlines).
import { schemaFields, schemaFor, validateSchema } from "@altasystem/sdk";

const schema = schemaFor("alta.quests/0.3");
console.log(schema.$id);
console.log(schemaFields(schema).length > 50);
console.log(validateSchema(schema, { schema: "alta.quests/0.3", id: "my-pack", branch: "core", quests: "none" }));

examples/sdk/schemas.mjs

Lance-le depuis un dossier où le paquet est installé : node example.mjs.

Sortie
text
alta.quests.schema.json
true
[ 'quests: must be array' ]

Fonctions ​

schemaFor ​

ts
function schemaFor(schemaField: string): Schema | undefined

The schema of a document, by its schema field.

validateSchema ​

ts
function validateSchema(schema: Schema, value: unknown): string[]

Problems of a value against a schema (empty = valid): <path>: <reason>.

schemaFields ​

ts
function schemaFields(doc: Schema): SchemaField[]

Every field of a schema: the properties of its definitions and its root, each once (a shared node is walked once).

Voir aussi ​

Le standard, le SDK et la CLI sont sous Apache-2.0 ; Alta System OS et Alta World sous FSL-1.1-ALv2.