Content types
CDS v0.2.0 uses URI-based content types instead of MIME vendor extensions. Every content type is a dereferenceable HTTP URI that resolves to a JSON-LD description of the schema.
The problem with opaque types
Section titled “The problem with opaque types”v0.1.0 used MIME strings like
application/vnd.cds.lottery-brazil.mega-sena-result+json;v=1. These were
informative but not resolvable — you could not fetch the string to learn what
it described. They were opaque identifiers, not Linked Data.
URI content types (v0.2.0)
Section titled “URI content types (v0.2.0)”https://signed-data.org/vocab/{domain-slug}/{schema-slug}Every content type encodes:
| Part | Meaning | Example |
|---|---|---|
| Base | Fixed namespace | https://signed-data.org/vocab/ |
{domain-slug} | Semantic domain (dots → hyphens) | lottery-brazil |
{schema-slug} | Event schema within the domain (dots → hyphens) | mega-sena-result |
Examples:
https://signed-data.org/vocab/lottery-brazil/mega-sena-resulthttps://signed-data.org/vocab/sports-football/match-resulthttps://signed-data.org/vocab/weather/forecast-currenthttps://signed-data.org/vocab/news/headlinehttps://signed-data.org/vocab/finance-brazil/rate-selichttps://signed-data.org/vocab/commodities-brazil/futures-sojahttps://signed-data.org/vocab/companies-brazil/profile-cnpjEach URI resolves to a JSON-LD document describing the schema, its domain, and links to the certified source.
Slug transformation rules
Section titled “Slug transformation rules”Domain and schema names use dots in code (e.g., lottery.brazil,
mega-sena.result). In URIs, all dots become hyphens:
("lottery.brazil", "mega-sena.result") → .../vocab/lottery-brazil/mega-sena-result("sports.football", "match.result") → .../vocab/sports-football/match-result("weather", "forecast.current") → .../vocab/weather/forecast-currentSource URIs are different — dots are kept:
"caixa.gov.br.loterias.v1" → .../sources/caixa.gov.br.loterias.v1Using content types in code
Section titled “Using content types in code”from cds.vocab import CDSVocab, CDSSources, content_type_urifrom cds.sources.lottery_models import LotteryContentTypes
# Pre-built constantsct = CDSVocab.LOTTERY_MEGA_SENAct = LotteryContentTypes.MEGA_SENA # same value
# Build from domain + schemact = content_type_uri("lottery.brazil", "mega-sena.result")# → "https://signed-data.org/vocab/lottery-brazil/mega-sena-result"
# On an eventevent.content_type # URI stringevent.domain # shortcut → "lottery.brazil"event.event_type # shortcut → "mega-sena.result"import { CDSVocab, contentTypeUri } from "@signeddata/cds-sdk";import { LotteryContentTypes } from "@signeddata/cds-sdk";
const ct = CDSVocab.LOTTERY_MEGA_SENA;const ct2 = contentTypeUri("lottery.brazil", "mega-sena.result");// → "https://signed-data.org/vocab/lottery-brazil/mega-sena-result"Routing by content type
Section titled “Routing by content type”Because the content type is a URI, systems can route events without inspecting the payload:
{ "source": ["cds.lottery.brazil"], "detail-type": ["mega-sena.result"]}if event.domain == "lottery.brazil" and event.event_type == "mega-sena.result": result = MegaSenaResult(**event.payload)Dereferencing
Section titled “Dereferencing”A content type URI is not just a label — it resolves to a JSON-LD document:
curl https://signed-data.org/vocab/lottery-brazil/mega-sena-resultReturns the schema definition including its domain, description, and link to the certified source.
Naming conventions
Section titled “Naming conventions”- Domain: lowercase, dots for hierarchy →
sports.football,government.brazil - Schema name: lowercase, dots or hyphens →
match.result,mega-sena.result - In URIs: all dots become hyphens →
sports-football,mega-sena-result - In code: use the pre-built constants (e.g.,
CDSVocab.LOTTERY_MEGA_SENA)
Registering a new content type
Section titled “Registering a new content type”To add a new domain or schema to the standard:
- Open an issue on
signed-data/cdswith thedomain-proposallabel - Include: data source, sample response, draft payload schema
- Create a PR adding
spec/domains/{domain}.mdandvocab/domains/{domain}.jsonld - Add models and ingestor to the SDK