Primitives and types
/ade/dashboard/primitives
Primitives & types is the registry of reusable JSON Schema 2020-12 types — the money, address and
identifier shapes your classes and properties point at with $ref. Go to Build → Primitives &
types. It has four tabs: Registry, Namespaces & scopes, Resolver and Settings.
Types come from two scopes: core system types every tenant can use (read-only), and your tenant types.
Registry


/ade/dashboard/primitivesUnder the header, one line sums up the registry: how many core system types, tenant types, imported schemas and properties bound, and how many unresolved $ref there are. When any reference is unresolved, that count is a red chip — click it to open the Resolver tab. Click “Show stats” to open the full statistics in place; Apiome remembers the choice in this browser.
Beside the type collections, Recent activity lists the last eight imports. The table lists each type's Name, Namespace, Category, Description, Usage and Type; search it, pick a category, and tick Show system to include the core types.
How resolution works
Click “How resolution works” in the page description to see how a relative $ref is resolved:
against the type's import-source base URL, with a worked example. Click “Open reference
resolver” to go to the Resolver tab, or “Got it” to close it.


/ade/dashboard/primitivesClick a type to open its page:


/ade/dashboard/primitives/[id]The page shows the type's JSON Schema (2020-12) (Copy, Download), Test this type, Reference resolution, an Example instance, its Dependents and Used by properties; on the right, Metadata, Used in and Base chain. “Edit”, “Export” and “Deprecate” are in the header.
To check a payload against the type, open Test this type, choose Single or Array and type the value — it is validated as you type.


/ade/dashboard/primitives/[id]See what uses a type
Before you change a type, check what depends on it. Scroll down a type's page to two cards:


/ade/dashboard/primitives/[id]- Dependents has one row for each
$reffrom another type to this one: the referencing type (click it to open it), the Property the$refsits on (a dash when the whole type is a reference), and its Scope — System · core or Tenant · your workspace. A type that references this one from two properties has two rows. - Used by properties has one row for each class property bound to this type — the ones whose
Primitive you chose in the Designer: the property as
Class.property(click it to open that version in the Designer; without Designer access it is plain text), its Project · Version, and the registry$refit is Bound as.
Used by properties covers only your workspace's projects: a system type is shared by every workspace, but you never see another workspace's properties. Properties in deleted classes, versions or projects are left out. When nothing is bound, the card reads No property in your projects uses this type.
The Properties figure under Used in is the type's running binding count, so it can be higher than the list: it also counts bindings removed since, and a system type's bindings in other workspaces.
Deprecate a type
Deprecate a type when it should no longer be picked up — for example when a newer type replaces it. Check what uses it first.
- Open the type's page and click “Deprecate”.
- Optionally set a Sunset date (the date after which the type should no longer be used; today or later), write a Message saying why and what to do instead, and choose a Replacement type. The list leaves out the type itself and types that are already deprecated.
- Click “Deprecate type”.


/ade/dashboard/primitives/[id]The type's page now shows a deprecated badge, a notice with the sunset date, your message and a
link to the replacement, and Lifecycle under Metadata reads deprecated · sunset <date>.
In the Registry table the type's name carries a deprecated marker. Once the sunset date has
passed, the notice turns red and reads Deprecated — sunset passed on date.


/ade/dashboard/primitives/[id]Deprecation is a marker, not a lock:
| A deprecated type | |
|---|---|
| Still resolves and validates | Every $ref to it keeps working, before and after the sunset date. |
| Keeps its bindings | Properties bound to it are unchanged, and it can still be chosen for new ones. |
| Is exported unchanged | Its JSON Schema is not modified. |
| Is recorded | Deprecating, changing and restoring are written to the registry audit log. |
To change the details, click “Edit deprecation”, change the fields and click “Save changes”; a field you clear is removed. To undo it, click “Restore”: the badge, the notice and the details are removed, and the type is active again.
Core system types cannot be deprecated: for them “Deprecate” is disabled. You need permission to edit types.
Create a type
- Click “Create primitive” (or press N).
- On Form, enter a Name (for example
currency-code) and choose its Type (string); the type cannot change after you create it. - Add a Description, Tags, constraints (format, pattern, length), Allowed values (enum), a Default value and Examples. The Schema preview at the bottom shows the result. Advanced JSON edits the schema directly.
- Click “Create”.


/ade/dashboard/primitivesImport types
Importing brings types you already have into the registry instead of retyping them. One import can create many types, and the types keep pointing at each other afterwards.
When to import
- You have a JSON Schema 2020-12 document — one schema, or one with reusable types under
$defs(or the olderdefinitions). - You have an Apiome type-definition bundle: one
.jsonor.yamlfile holding many types undertypes. - You want the reusable types of an OpenAPI 3.1 description — its
components/schemas.
To add a single new type by hand, create it instead.
Import at a glance
| Step | Where | Details |
|---|---|---|
| Choose what you are importing | Source step, Source type | Source types |
| Give the document | Source step: File, URL or Paste | Run an import |
| Choose where the types go | Target namespace (optional) | Namespaces & scopes |
| Keep references working | Done for you when the types are saved | How references are kept |
| Settle clashes with existing types | Review step | Review and conflicts |
| Read what happened | Result step | The result |
| Do it without the screen | CLI or REST API | Import with the CLI, Import with the API |
Source types
| Source type | What becomes a type |
|---|---|
| JSON Schema | Each entry under $defs or definitions. A document with neither is imported as one type. |
| Type-def bundle | Each entry under types (or $defs / definitions). A bundle of 12 types imports 12 types. |
| OpenAPI | Each entry under components/schemas — see From an OpenAPI 3.1 document. |
Every type is checked as a JSON Schema 2020-12 schema before it is saved.
Run an import
Click “Import from schema” (or press I). The Import primitives dialog has three steps: Source, Review and Result.
- Source — under Source type, choose JSON Schema, Type-def bundle or OpenAPI.
Then give the document as a File (
.json,.yamlor.yml), a URL or Paste. - Under Options, enter a Target namespace (optional) if the types should not go to the
default one, or tick Always extract namespace automatically to take it from the document.
Two more options are ticked to begin with:
- Map recognized formats to core JSON System types — see How references are kept.
- Skip definitions identical to an existing type — see Review and conflicts.
- Review — Apiome lists the types it found. Untick any you do not want, and for each one that clashes with an existing type choose Keep existing, Overwrite or Import as new name.
- Click “Import N selected”, then read the Result and click “Done”.


/ade/dashboard/primitivesHow references are kept
Inside a source document, types point at each other with references that only mean something in
that document, such as #/$defs/Money. When the types are saved, Apiome rewrites each of these to a
relative reference to the saved type:
| In the source | In the registry |
|---|---|
#/$defs/Money | ./money |
#/definitions/Money | ./money |
#/types/Money | ./money |
#/components/schemas/Money | ./money |
#/$defs/Money/properties/amount | ./money#/properties/amount |
Relative references keep working when a namespace moves to another base URI, and the
Resolver follows them like any other $ref.
With Map recognized formats to core JSON System types ticked, a string that only says
"format": "email" (or uuid, uri, date, date-time, time) is also pointed at the matching
core system type, so every imported email is the same type. A $ref you wrote yourself is never
replaced.
Review and conflicts
The Review step shows what the import would do before anything is saved. Each type has one status:
| Status | Meaning | What happens |
|---|---|---|
| New | No type with this name exists in the target namespace. | It is created. |
| Identical | The same type is already there. | It is skipped, while Skip definitions identical to an existing type is ticked. |
| Conflict | A type with this name exists and differs. | You choose — see below. |
| Invalid | It is not a valid JSON Schema 2020-12 schema. | It cannot be imported; the row lists what is wrong. |
For a Conflict, choose one:
- Keep existing — the type in the registry stays as it is. This is the default, so an import never replaces a type unless you say so.
- Overwrite — the type in the registry is replaced by the imported one.
- Import as new name — the imported type is saved beside the existing one under the name you enter.
A type that points at something Apiome cannot find is marked as having an unresolved reference. It still imports; fix the reference later on the Resolver tab.
The result
The Result step counts the types under Imported, Overwritten, Renamed, Identical (skipped), Skipped and Errors. A conflict you left on Keep existing is under Skipped. Every import is recorded: the last eight are under Recent activity on the Registry tab, and the imported schemas count in the facts line goes up.
From an OpenAPI 3.1 document
Choose OpenAPI to import the reusable types of an API description. Each entry under
components/schemas becomes one type, named after its component; the document's info, paths
and other components are not types and are left out.
- References. A
$refto another component, such as#/components/schemas/Money, is rewritten to a reference to that type in the registry (./money), so the imported types still point at each other. A reference to a type arriving in the same import is not reported as unresolved. - Versions. OpenAPI 3.1 schemas are JSON Schema 2020-12, so they are validated as written. An
OpenAPI 3.0 document still imports, with a warning that 3.0-only keywords may not validate. A
jsonSchemaDialectother than 2020-12 is warned about too. - Not OpenAPI. A document with no
openapiversion, with a version other than 3.x, or with nocomponents/schemasis refused with a message saying why. A Swagger 2.0 document keeps its types underdefinitions: import it as JSON Schema instead.
Namespaces & scopes
A namespace groups types under a base URI and version, such as tenant/acme/v1/types. The tab
shows the system root and your tenant namespaces, and the order a $ref is resolved in: your tenant
namespace, then imported vendor namespaces, then the core system types.
Click “New namespace” and enter a Namespace path, Base URI, Version root and Description, and choose a Root status; tick Default namespace to make new types land there. System namespaces are Read-only.


/ade/dashboard/primitivesVersion roots: stable and draft
The version root is the vN part of a namespace path — v1 in tenant/acme/v1/types. Each
namespace says whether its root is settled:
| Root status | Use it for |
|---|---|
| Stable (the default) | Types that are settled and safe to build on. |
| Draft | The next version while it is still being worked on: its types may still change shape. |
A draft root shows a draft marker beside its Version root in the table. To see draft roots apart from stable ones, use the All / Stable / Draft filter above the table; the footer counts the draft roots.
To start the next version, create a namespace for it — for example tenant/acme/v2/types — with
Root status set to Draft. When it is ready, click “Edit” on its row, set Root
status to Stable and click “Save changes”. The status is a label: it does not change how
a $ref resolves. System namespaces are always stable.
Resolver
The Resolver shows how every $ref in your types resolves — Resolved, Unresolved or
Circular — as a list and a reference graph. Filter by Namespace, and click
“Re-resolve” after fixing a reference.


/ade/dashboard/primitivesSettings
Settings chooses the JSON Schema dialect, how references resolve (the base URL and $ref
style), Import defaults and Validation & publishing rules for this tenant. Click “Save
settings”, or “Reset to defaults”.


/ade/dashboard/primitivesWith the CLI or the API
- CLI:
apiome types list|show|search— see the CLI quick-start — andapiome primitives import— see Import primitives with the CLI. - REST:
GET/POST /v1/primitives/{tenant},GET /v1/primitives/{tenant}/{id}(withdependentsandproperty_dependents),GET/POST /v1/types/{tenant}/namespaces,GET/PUT /v1/types/{tenant}/settings,POST /v1/types/{tenant}/resolve— see the API reference.
Deprecate types and manage version roots with the API
| Call | What it does |
|---|---|
POST /v1/primitives/{tenant}/{id}/deprecate | Deprecates the type, or replaces a deprecated type's details. Body (all optional): sunset_date (YYYY-MM-DD), message (up to 500 characters), replacement_id. |
DELETE /v1/primitives/{tenant}/{id}/deprecate | Restores the type. Does nothing if it is not deprecated. |
GET /v1/primitives/{tenant}/{id} | Returns deprecated, deprecated_at, sunset_date, deprecation_message, replacement_id and replacement (id, name, schema_id). List and search rows carry all but replacement. |
GET /v1/types/{tenant}/namespaces?root_status=draft | Lists only draft roots; root_status=stable lists only stable ones. Every namespace carries root_status. |
POST / PUT /v1/types/{tenant}/namespaces | Accept root_status: stable (the default) or draft. |
Deprecating returns 422 when the sunset date is in the past, or when the replacement is not
found, is the type itself or is deprecated; 403 for a core system type. The calls are on the
Primitives and
Type registry REST references, and the audit entries
(primitive.deprecate, primitive.restore) on the
Registry audit reference.
Import primitives with the CLI
apiome primitives import <file> adds a file of primitives to your tenant in one go — for example
the loyalty IDs, SKU formats and region codes a new tenant starts with. All flags are on the
apiome primitives reference.
-
Write the file, in JSON or YAML: one primitive, or a list of them. Each has a
name, abase(a JSON Schema type:string,number,integer,boolean,object,arrayornull) and any other JSON Schema keyword, such aspattern,format,enum,descriptionorexamples.acme-primitives.yaml- name: acme-loyalty-idbase: stringpattern: ^LM-[0-9]{8}$examples: [LM-00000001, LM-12345678]- name: acme-region-codebase: stringpattern: ^(EU|US|APAC)$- name: acme-internal-skubase: stringpattern: ^SKU-[A-Z0-9]{10}$ -
See what the import would do. Nothing is saved:
apiome primitives import ./acme-primitives.yaml --dry-runWould import 2 primitives:+ acme-region-code (string, pattern ^(EU|US|APAC)$)+ acme-internal-sku (string, pattern ^SKU-[A-Z0-9]{10}$)Conflicts (skipped without --update):~ acme-loyalty-id (already exists, would be overwritten with --update) -
Import. In a terminal the command shows the same plan and asks before it saves;
--yesskips the question:apiome primitives import ./acme-primitives.yaml --yes✔ Imported 2 new, updated 0 existing primitives.Skipped 1 conflict (pass --update to overwrite).
Without a terminal — in a script or a CI job — nothing is saved unless you pass --yes.
| To | Pass |
|---|---|
| Overwrite a primitive that already exists with a different schema | --update |
| Leave existing primitives alone (the default) | --skip-conflicts |
| Import the good rows when others fail | --continue-on-error |
| Keep a JSON record of every row | --report report.json |
| Read the primitives from stdin | No file, or - |
What is checked. Before anything is sent, each row is checked on your machine: it has a name
no other row uses, base is a JSON Schema type, pattern is a regular expression, the schema is
valid JSON Schema 2020-12 and every example matches it. A file with more than 50 rows shows a
progress bar while it is checked. Apiome then reviews the rows the same way the Import
primitives dialog does — see Review and conflicts. A primitive identical
to an existing one is left as it is.
When a row fails. Each failed row is listed with its row number and the reason. Nothing is
imported and the command exits with code 7. With --continue-on-error the other rows are
imported and the command exits with 0. The rows go to Apiome in one request and are saved one
by one, so a row that fails while saving does not undo the rows saved before it.
The report. --report <path> writes one entry for each row — row, name, status and
message — and a summary that counts the rows by status. After a dry run the statuses are new,
overwrite, conflict and unchanged; after an import they are imported, updated, skipped
and unchanged. A row that was not imported is invalid, failed, system (a read-only core
system type) or aborted (left out because another row failed). apiome --json primitives import … prints the same report.
Copy primitives back in. A row can also be a primitive as apiome types list --json prints it
— a name and a schema — so the list can be saved, edited and imported again:
apiome --json types list | apiome primitives import --update --yes
Core system types in the list are skipped. Each row keeps the $id in its schema, so it updates
the primitive it came from; to copy a primitive to another tenant as a new type, remove $id from
its schema first.
Import types with the API
The dialog uses the same endpoints, so an API import gives the same result. All of them are on the Primitives REST reference.
| Call | What it does |
|---|---|
POST /v1/primitives/{tenant}/import/review | Dry run: returns each type's status, validation report and reference rewrites. Saves nothing. |
POST /v1/primitives/{tenant}/import | Saves the types and returns the report with an import_id. |
POST /v1/primitives/{tenant}/import/stage | Fetches and parses a source — pasted text, a file's text, a URL, or a file in a public GitHub repository — and lists the types it found. Saves no types. |
GET /v1/primitives/{tenant}/imports | Lists past imports. |
GET /v1/primitives/{tenant}/imports/{import_id} | One past import, with its report. |
In the body of /import/review and /import:
| Field | Value |
|---|---|
schema | The document, as JSON. |
source_kind | json-schema (the default), type-def-bundle or openapi. |
import_all / selected_definitions | Import every type, or only the named ones. |
target_namespace | The namespace the types go to. |
map_core_formats | true by default — see How references are kept. |
dedupe | true by default: an identical type is skipped. |
resolutions | For /import only. One entry for each conflicting type: {"action": "keep"}, {"action": "overwrite"} or {"action": "rename", "new_name": "money-v2"}. |
Review needs permission to view types; importing and staging need permission to create them.