Ultrahost/ docs

This block has two related resources. A schema describes structure. An ontology describes semantic relationships. Both live on ultrahost.contracts.

Paths in the tables are relative to https://api.ultrahost.com/v1/projects/{projectId}. Pagination, idempotency, and errors are described in Conventions.

Create

Schemas

SDKRESTDescription
contracts.createSchema(name, schema)POST /contracts/schemasCreate a schema
contracts.getSchema(name, version?)GET /contracts/schemas/{name}Retrieve a schema
contracts.listSchemas()GET /contracts/schemasList schemas
contracts.publishSchema(name, version)POST /contracts/schemas/{name}/versionsPublish a version
contracts.listVersions(name)GET /contracts/schemas/{name}/versionsVersion history
contracts.deprecate(name, version)POST /contracts/schemas/{name}/versions/{version}/deprecateDeprecate a version

Ontologies

SDKRESTDescription
contracts.createOntology(name, definition)POST /contracts/ontologiesCreate an ontology
contracts.getOntology(name, version?)GET /contracts/ontologies/{name}Retrieve an ontology
contracts.listOntologies()GET /contracts/ontologiesList ontologies
contracts.updateOntology(name, definition)PATCH /contracts/ontologies/{name}Update the draft
contracts.publishOntology(name, version)POST /contracts/ontologies/{name}/versionsPublish a version
ts
await ultrahost.contracts.createSchema("property", {
  type: "object",
  required: ["address", "rent"],
  properties: {
    address: { type: "string" },
    rent: { type: "number" }
  }
});

Configure

Published versions are immutable. A rollback moves the active version pointer. It does not delete history.

updateOntology edits the draft. publishOntology freezes a version. Deprecating a schema version keeps it readable and marks it as no longer the one callers should write against. getSchema(name, version) without a version returns the active version.

Use

SDKRESTDescription
contracts.validate(name, data, version?)POST /contracts/schemas/{name}/validateValidate data against a schema
contracts.compare(name, from, to)POST /contracts/schemas/{name}/compareCompare two versions
contracts.validateOntology(name, data)POST /contracts/ontologies/{name}/validateValidate semantic relationships
ts
const result = await ultrahost.contracts.validate("property", propertyData);

Validation belongs at the boundary of a write: in a function, or before documents.create(). The document store does not replace schemas. They work together when a collection's configuration points at a schema name.