Ontology

Changing the ontology safely

Compatible and breaking changes, impact preview, confirmation, direct-edit settings and proposals.

Other things rely on an object type, a link type or an interface: actions, computed properties on other types, interfaces and the types that implement them. Before a change goes live, the product tells you what it would affect and asks you to confirm anything that would break.

Compatible and breaking changes

Every change is classified. A compatible change needs nothing from you. A warning change goes live without confirmation, but may affect something the product cannot track. A breaking change can stop something that works today.

ChangeResult
Add a property, a link type or an object typeCompatible
Change a display name or a property labelCompatible
Change a property's type (property_type_changed)Breaking
Remove a property (property_removed)Breaking
Remove the property used as the title (title_property_removed)Breaking
Point a property at another column (property_column_changed)Breaking
Change an object type's key columns (backing_key_changed) or its table (backing_relation_changed)Breaking
Rename the key of an object type (key_changed)Breaking
Stop actions editing a property (property_not_editable)Breaking
Change a formula, aggregate or distance (derived_expression_changed, derived_aggregate_changed, graph_distance_changed)Breaking
Change a link's endpoints, columns or cardinality (link_endpoint_changed, link_columns_changed, link_cardinality_changed)Breaking
Take an interface off a type, or change how it is matched (interface_removed, interface_mapping_changed)Breaking
Make an interface property required (required_property_added)Breaking
Delete a definition (definition_deleted)Breaking
Turn off Searchable or Filterable on a propertyWarning
Close an open enum, or remove a choice from a closed oneWarning

Warnings exist because the product does not keep a full list of saved filters or stored values. These changes are never refused, but they can affect something it cannot see.

Preview the impact before you save

On the property page, the interface page and the other editors, a What changes card shows the effect of your unsaved edit. It lists:

  • the changes, each marked Breaking or Warning, in plain words;
  • What uses it: the object types, actions, link types and interfaces that would be affected, and which of their properties break;
  • more things you can't see: how many affected definitions are hidden from you (see below);
  • a line starting "Couldn't check", for things the preview could not look at.

The card also says how the change goes live in How it goes live: Publish now or Stage in proposal.

Nothing is saved by a preview. In the API:

POST /vegagraph/ontology:preview-impact
{
  "kind": "object_type",
  "key": "party",
  "op": "put",
  "definition": { "key": "party", "display_name": "Party", "...": "..." }
}

kind is object_type, link_type or interface. op is put (the default) or delete. The response:

{
  "impact": {
    "kind": "object_type",
    "key": "party",
    "op": "put",
    "classification": "breaking",
    "classes": [
      { "class": "property_type_changed", "property": "risk_score", "level": "breaking" }
    ],
    "dependents": {
      "object_types": [],
      "actions": [{ "key": "escalate_party", "broken_properties": ["risk_score"] }],
      "link_types": [],
      "interfaces": [],
      "hidden_count": 2
    },
    "consumers": { "by_type": {}, "hidden_count": 0, "truncated": false }
  },
  "requires_accept_breaking": true,
  "ontology_direct_edits": true,
  "proposal_required": false,
  "can_publish_directly": true,
  "could_not_check": []
}
  • dependents lists readable definitions that depend on this one, plus hidden_count.
  • consumers lists readable things built on the definition, with a separate hidden_count.
  • could_not_check lists what the preview could not look at.

What "can publish directly" means

can_publish_directly says whether the change can go live right now. It is false when the workspace requires proposals, or when an interface no longer fits a type that implements it.

It can also be false only because could_not_check contains action_dependencies_unchecked, which means some actions could not be read. That case is advice, not a block. The server still accepts a compatible change, and the product shows the note and still lets you publish. Deleting an object type or interface in this state is refused, because the check is needed to know what would break.

If the preview would be too large to compute, it fails with a 422 error rather than publishing without a check.

Publishing a breaking change directly

When you press Publish now and the change is breaking, a dialog asks you to confirm. Its title says how much would break, for example "Publish and break 3 things that use it?". It lists:

  • What changes: each breaking class and warning;
  • the affected definitions and which properties break;
  • how many more affected definitions you can't see;
  • a note that code pinned to an earlier version stops.

Choose Keep editing to go back, Stage in a proposal to put the change in a proposal instead, or Publish anyway to go live. A draft save or a first publication of a new definition needs no confirmation. If someone else saved a newer version first, you see "Someone saved this first" and can reload it without losing your edits.

In the API a breaking direct save is refused first:

PUT /vegagraph/ontology/object-types/party
{ "definition": { "key": "party", "...": "..." }, "expected_version": 4 }

An update must say which version it replaces in expected_version; without it the save is refused with 428.

HTTP/1.1 409 Conflict
{
  "code": "ontology_breaking_confirmation_required",
  "message": "publication is breaking; review impact and set accept_breaking",
  "impact": { "classification": "breaking", "classes": [ { "class": "property_removed", "property": "risk_band", "level": "breaking" } ] },
  "dependents": { "object_types": [], "actions": [ { "key": "escalate_party", "broken_properties": ["risk_band"] } ], "link_types": [], "interfaces": [], "hidden_count": 0 }
}

Show that to the person, and if they agree, send the same request again with accept_breaking:

{ "definition": { "key": "party", "...": "..." }, "expected_version": 4, "accept_breaking": true }

The same field exists on link type and interface saves. It acknowledges breaking classes only. It does not override the workspace setting that requires proposals, a type that no longer fits an interface, a version conflict or a deletion that is blocked. The accepted version is recorded in the history of the definition.

A save made against an out-of-date version returns 412, not 409. Load the newer version first.

Requiring proposals

By default editors can publish a change right away. A workspace can turn that off so that every change to an object type, link type or interface goes through a proposal.

In the product, use the Direct edits switch on the Ontology page. On: editors publish right away. Off: every change goes through a proposal, and merging needs the workspace govern permission. In the API:

GET /vegagraph/ontology/settings
{ "ontology_direct_edits": false }

Updating the setting needs the govern permission. When it is off, Publish now shows Off and the Proposal row shows Needed.

Proposals

A proposal is a named bundle of changes that goes live together, or not at all.

  1. Stage. On an editor, choose Stage in proposal. Join the open proposal or start A new proposal with a name. Nothing changes for anyone until the proposal is merged.
  2. Review. The proposal page shows the changes and their impact on actions, other types and consumers.
  3. Merge. Merging checks the combined result, then publishes every change in one step. If any part fails, nothing is published.

A merge is itself the approval of the combined impact, so it needs no accept_breaking.

Interfaces and the types that implement them

An interface and the types that implement it often have to change together. While staging, the interface does not need to fit yet. You can stage:

  • a new interface and the types that implement it, in either order;
  • a type that drops or changes an interface, then the interface change;
  • a changed interface and the types that must change to fit it.

Each preview lists every implementing type and why it does not fit yet. Fit is checked at merge. If any type still does not fit, the merge is refused and nothing is published. Fix the types in the proposal and merge again.

Two ordering rules apply. Delete an interface only after you have staged the change that takes it off the types that implement it. Removing a staged new interface from a proposal while a staged type still implements it leaves the proposal unmergeable until that type is changed.

Publishing an interface directly needs every published implementer to fit. A proposal is the safer way to change both together.

Proposals in the API

OperationPath
CreatePOST /vegagraph/ontology/proposals with title and optional description
Stage a changePUT /vegagraph/ontology/proposals/{id}/changes/{kind}/{key} with op (put or delete) and definition
Remove a staged changeDELETE /vegagraph/ontology/proposals/{id}/changes/{kind}/{key}
Preview impactPOST /vegagraph/ontology/proposals/{id}:preview-impact
MergePOST /vegagraph/ontology/proposals/{id}:merge
Close without mergingPOST /vegagraph/ontology/proposals/{id}:close
ListGET /vegagraph/ontology/proposals?state=draft

kind is object_type, link_type or interface. A merge that finds a type that does not fit returns 422 interface_not_satisfied.

When something you can't read would break

Some definitions may be hidden from you by access rules. The product never names them, shows their properties or their fit details. Instead it says "N more things you can't see", and the API returns the count in hidden_count (dependents and consumers each have one).

If a change would break an interface or type you cannot read, the error says "this change breaks a definition you can't see". Ask someone who can read that definition to review the change before you publish it.

Naming an interface you cannot read, or one that does not exist, gets the same answer: "interface is unavailable".

Vegalake, VegaDB and VegaFlow are trademarks or registered trademarks of Vegalake Inc.

On this page