Chapter 4
Extensions add vocabulary and validation to the core.
The core profile shape is intentionally small. Extensions define the concrete words that make a profile useful: kinds, interface types, fields, field values, and JSON Schema validation.
What an extension owns
| Extension Part | What It Does | Example |
|---|---|---|
| `kinds` | Defines Condition categories. | `api`, `datastore`, `cache` |
| `interfaceTypes` | Defines valid interface types for a kind. | `http` for `api`, `key_value` for `cache` |
| `interfaceFields` | Defines extension-owned fields inside `interface`. | `interface.engine`, `interface.operations` |
| `fieldValues` | Defines allowed values for extension-owned fields. | `redis`, `memcached`, `GET`, `POST` |
| `schemas` | Defines machine-readable validation. | JSON Schema for HTTP API Conditions |
First-party extension: Common Integrations
The Common Integrations extension defines standard integration vocabulary for APIs, datastores, and caches. Profiles that use `kind: cache` or `interface.type: http` depend on this extension.
metadata:
uri: https://runtimeconditions.io/extensions/common-integrations
version: v1alpha1
spec:
kinds:
- name: api
- name: datastore
- name: cache
interfaceTypes:
- name: http
targetKind: api
- name: key_value
targetKind: cache
Field values make vocabulary deterministic
The extension does not merely say an engine field may exist. It also owns the shared values that validators and adapters can rely on.
fieldValues:
- field: interface.engine
targetKind: cache
targetType: key_value
values:
- redis
- memcached
fieldValues:
- field: interface.operations[].method
targetKind: api
targetType: http
values:
- GET
- HEAD
- POST
- PUT
- PATCH
- DELETE
- OPTIONS
- TRACE
Extensions define JSON Schema validation
Schema rules make extension validation portable. The validator can evaluate the profile without interpreting prose.
schemas:
- id: api-http-interface
appliesToKind: api
appliesToInterfaceType: http
description: Validates HTTP API integration conditions.
schema:
type: object
required:
- kind
- interface
properties:
kind:
const: api
interface:
type: object
required:
- type
properties:
type:
const: http
operations:
type: array
items:
required:
- method
- path
First-party extension: Environment Configuration
The Environment Configuration extension adds the `configuration` field. It lets a profile say which workload-facing inputs are expected without embedding the values.
spec:
dependencies:
- https://runtimeconditions.io/extensions/common-integrations:v1alpha1
conditionFields:
- name: configuration
appliesToAllKinds: true
fieldValues:
- field: configuration.env[].property
targetKind: cache
targetType: key_value
values:
- url
- hostname
- port
- username
- password
- token
How a profile uses extensions
The profile declares every extension required to interpret its vocabulary. Transitive dependencies are resolved by validators and tooling, but generated profiles should still declare the vocabulary they directly use.
extensions:
- https://runtimeconditions.io/extensions/common-integrations:v1alpha1
- https://runtimeconditions.io/extensions/env-configuration:v1alpha1
conditions:
- name: request-cache
kind: cache # common-integrations
interface:
type: key_value # common-integrations
engine: redis # common-integrations field value
configuration: # env-configuration
alternatives:
- env:
- property: url # env-configuration field value
name: REDIS_URL
Third-party extensions follow the same rules
The AWS Object Store extension is treated as a third-party example. It defines `aws.object_store`, `aws.s3`, S3-specific fields, and depends on first-party configuration vocabulary.
metadata:
uri: https://aws.example.com/runtimeconditions/object-store
version: v1alpha1
spec:
dependencies:
- https://runtimeconditions.io/extensions/common-integrations:v1alpha1
- https://runtimeconditions.io/extensions/env-configuration:v1alpha1
kinds:
- name: aws.object_store
interfaceTypes:
- name: aws.s3
targetKind: aws.object_store