{"openapi":"3.1.0","components":{"schemas":{"RecordMeta":{"type":"object","description":"Server-managed metadata of a record version (Dublin Core created/modified).","required":["contractId","boid","version","status","created","modified"],"properties":{"contractId":{"type":"string","description":"Id of the data contract."},"boid":{"type":"string","format":"uuid","description":"Business object id."},"version":{"type":"integer","minimum":1,"description":"Version number of the record."},"status":{"type":"string","enum":["active","superseded","unverified","deleted"]},"created":{"type":"string","format":"date-time","description":"First creation of the record."},"modified":{"type":"string","format":"date-time","description":"Creation of this version."},"creator":{"type":["string","null"],"description":"Subject that created the record; null when anonymous."},"contributor":{"type":["string","null"],"description":"Subject that wrote this version; null when anonymous."},"restricted":{"type":"boolean","description":"Present and true for a restricted record (GDPR Art. 18)."},"unenforcedRules":{"type":"array","description":"Only in the response to a write; quality rules of the contract the service did not execute.","items":{"type":"object","required":["field","rule","reasonCode"],"properties":{"field":{"type":"string"},"rule":{"type":"string"},"reasonCode":{"type":"string"}}}}}},"PageMeta":{"type":"object","required":["total","page"],"properties":{"total":{"type":"integer","minimum":0},"page":{"type":"object","required":["number","size"],"properties":{"number":{"type":"integer","minimum":1},"size":{"type":"integer","minimum":1}}}}},"JsonApiResource":{"type":"object","required":["type","id","attributes","meta"],"properties":{"type":{"type":"string","description":"Resource type of the contract."},"id":{"type":"string","format":"uuid","description":"BOID."},"attributes":{"$ref":"#/components/schemas/Attributes"},"meta":{"$ref":"#/components/schemas/RecordMeta"}}},"JsonApiDocument":{"type":"object","description":"One record as JSON:API document (application/vnd.api+json).","required":["data"],"properties":{"data":{"$ref":"#/components/schemas/JsonApiResource"}}},"JsonApiCollection":{"type":"object","description":"Several records as JSON:API document; meta only for a paged list.","required":["data"],"properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/JsonApiResource"}},"meta":{"$ref":"#/components/schemas/PageMeta"}}},"FlatRecord":{"description":"One record as flat JSON (application/json); technical fields under _meta.","allOf":[{"$ref":"#/components/schemas/Attributes"},{"type":"object","required":["_meta"],"properties":{"_meta":{"$ref":"#/components/schemas/RecordMeta"}}}]},"FlatCollection":{"type":"array","items":{"$ref":"#/components/schemas/FlatRecord"}},"CloudEvent":{"type":"object","description":"CloudEvents 1.0 attributes shared by every event (ADR-030 section 2).","required":["specversion","id","source","type","subject","time","datacontenttype"],"properties":{"specversion":{"const":"1.0"},"id":{"type":"string","description":"Idempotency key; the same in every version of the event type."},"source":{"type":"string","description":"Product id of the EDP (URN)."},"type":{"type":"string","description":"Full type including the event version, e.g. de.bund.kks.dp.record.updated.v1."},"subject":{"type":"string","description":"BOID of the record"},"time":{"type":"string","format":"date-time"},"datacontenttype":{"const":"application/json"}}},"RecordEvent":{"description":"Event about a record version (record.created, record.updated, record.deleted).","allOf":[{"$ref":"#/components/schemas/CloudEvent"},{"type":"object","required":["tenant","recordversion","data"],"properties":{"dataschema":{"type":"string","format":"uri","description":"Contract version the data adheres to; missing without a configured base address."},"tenant":{"type":"string"},"recordversion":{"type":"integer","minimum":1},"data":{"type":"object","required":["boid","version","status"],"properties":{"boid":{"type":"string","format":"uuid"},"version":{"type":"integer","minimum":1},"status":{"type":"string","enum":["active","superseded","unverified","deleted"]},"link":{"type":"string","format":"uri","description":"This version in the Entity API; missing for a deleted record."}}}}}]},"RestrictionChangedEvent":{"description":"A restriction of a record was set or lifted (record.restriction-changed, GDPR Art. 18).","allOf":[{"$ref":"#/components/schemas/RecordEvent"},{"type":"object","properties":{"data":{"type":"object","required":["restricted"],"properties":{"restricted":{"type":"boolean","description":"The new state."}}}}}]},"LifecycleEvent":{"description":"New version or status of the data contract or the product description.","allOf":[{"$ref":"#/components/schemas/CloudEvent"},{"type":"object","required":["data"],"properties":{"data":{"type":"object","required":["id","version","versionId","status"],"properties":{"id":{"type":"string","description":"Contract or product id."},"version":{"type":["string","null"],"description":"Business version of the document."},"versionId":{"type":"integer","minimum":1,"description":"Version in the registry."},"status":{"type":"string"},"previousVersion":{"type":["string","null"]},"previousStatus":{"type":["string","null"]},"link":{"type":"string","format":"uri"}}}}}]},"ApiDocs":{"type":"object","properties":{"entity":{"type":"string"},"spec":{"type":"string"},"admin":{"type":"string"}}},"Entity":{"type":"object","properties":{"resource":{"type":"string"},"entityApiPath":{"type":"string"},"identifier":{"type":"string"},"keyFields":{"type":"array","items":{"type":"string"}},"fields":{"type":"array","items":{"$ref":"#/components/schemas/Field"}}}},"Field":{"type":"object","properties":{"name":{"type":"string"},"type":{"type":"string"},"required":{"type":"boolean"},"valueRange":{"$ref":"#/components/schemas/ValueRange"}}},"Links":{"type":"object","properties":{"contractYaml":{"type":"string"},"contractJson":{"type":"string"},"productYaml":{"type":"string"},"productJson":{"type":"string"},"entityApi":{"type":"string"},"swaggerUi":{"type":"string"},"openapi":{"type":"string"},"apiDocs":{"$ref":"#/components/schemas/ApiDocs"},"health":{"type":"string"}}},"ProblemDetails":{"description":"Fehlerobjekt nach RFC 9457 (application/problem+json). Bei Validierungsfehlern (400/422) trägt das Feld violations die Einzelverstöße.","type":"object","properties":{"type":{"type":"string","description":"Kategorie-URI des Fehlertyps (RFC 9457); \"about:blank\" wenn nicht kategorisiert. Feature-spezifische URIs werden feature-seitig dokumentiert.","examples":["about:blank"]},"title":{"type":"string","description":"Kurzer, menschenlesbarer Titel des Fehlers.","examples":["Validierung fehlgeschlagen"]},"status":{"type":"integer","format":"int32","description":"HTTP-Statuscode des Fehlers.","examples":[422]},"detail":{"type":"string","description":"Erläuterung dieses konkreten Vorkommens.","examples":["Der Datensatz verletzt im Contract deklarierte Regeln"]},"violations":{"type":"array","items":{"type":"object","additionalProperties":{"type":"string"}},"description":"Einzelverstöße. Entity-Schemafehler tragen den Schlüssel field, Fachregel-Verstöße den Schlüssel rule, Dokument-Schemaverstöße (ODCS/ODPS gegen JSON-Schema) den Schlüssel path, jeweils mit message.","examples":[[{"rule":"meldepflicht-konsistenz","message":"Bei kategorie=meldepflichtig muss meldepflichtig=true sein"}]]}}},"ServiceIndex":{"type":"object","properties":{"service":{"type":"string"},"title":{"type":"string"},"version":{"type":"string"},"entity":{"$ref":"#/components/schemas/Entity"},"links":{"$ref":"#/components/schemas/Links"}}},"UUID":{"type":"string","format":"uuid","pattern":"[a-fA-F0-9]{8}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{4}-[a-fA-F0-9]{12}"},"ValueRange":{"type":"object","properties":{"allowedValues":{"type":"array","items":{"type":"string"}},"pattern":{"type":"string"},"minLength":{"type":"integer","format":"int32"},"maxLength":{"type":"integer","format":"int32"},"format":{"type":"string"},"minimum":{"type":"number"},"maximum":{"type":"number"},"exclusiveMinimum":{"type":"number"},"exclusiveMaximum":{"type":"number"},"multipleOf":{"type":"number"}}},"Attributes":{"type":"object","properties":{"proben_kennung":{"type":"string"},"labor_id":{"type":"string"},"labor_bezeichnung":{"type":"string"},"lims_ref":{"type":"string"},"uebertragungsweg":{"type":"string"},"betrieb_id":{"type":"string"},"bestand_ref":{"type":"string"},"datum":{"type":"string","format":"date-time"},"art":{"type":"string"},"fachbereich":{"type":"string","pattern":"^(TS|TSCH|TAM)$"},"tierart":{"type":"string"},"material":{"type":"string"},"erkrankung":{"type":"string"},"erreger":{"type":"string"},"diagnoseverfahren":{"type":"string"},"anz_untersucht":{"type":"integer"},"anz_befunde":{"type":"integer"},"anz_negativ":{"type":"integer"},"anz_positiv":{"type":"integer"},"anz_andere":{"type":"integer"},"datum_eingang":{"type":"string","format":"date-time"},"datum_befund":{"type":"string","format":"date-time"},"datum_erledigt":{"type":"string","format":"date-time"},"bemerkungen":{"type":"string"},"termin_bezeichnung":{"type":"string"},"termin_art":{"type":"string"},"termin_status":{"type":"string"},"termin_verantwortlicher":{"type":"string"},"tierarzt_id":{"type":"string"}},"required":["betrieb_id","datum","art","fachbereich"]}},"securitySchemes":{"SecurityScheme":{"description":"Authentication","type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"tags":[{"name":"Entity API","description":"Lesen und Schreiben der Fachdatensätze. Repräsentation als JSON:API (Default), Flat-JSON (Accept: application/json) oder — falls der Contract ein Geometrie-Feld deklariert (physicalType: geometry) — GeoJSON (Accept: application/geo+json, RFC 7946; sonst 406). Struktur und Validierung kommen generisch aus dem ODCS-Contract; Schreibzugriffe prüfen Schema und Fachregeln (parsebar, aber regelwidrig → 422). Schreiben ist append-only versioniert."}],"paths":{"/laborprobe":{"get":{"summary":"Collection der aktiven Datensätze (filter-/sortier-/paginierbar)","description":"Liefert die aktiven Datensätze. JSON:API-Dokument ({data:[…], meta:{total,page}}) oder Flat-JSON-Array (Accept: application/json). Query: filter[feld]([gt|lt|gte|lte]), sort (-=absteigend), page[number]/page[size] (max 100), fields[type] (Sparse Fieldsets). Filter-/Sortier-/fields-Felder müssen Contract-Felder oder meta.(status|version|created) sein.Hinweis: meta.total/page liefert nur die JSON:API-Repräsentation; Flat-JSON ist ein reines Array ohne Paginierungs-Metadaten.","tags":["Entity API"],"responses":{"200":{"description":"Gefilterte/sortierte/paginierte Liste (JSON:API oder Flat-JSON).","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiCollection"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatCollection"}}}},"400":{"description":"Ungültiger Query-Parameter (unbekanntes Feld, unzulässiger Bereichsoperator).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Unbekannter Contract-Slug.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"406":{"description":"application/geo+json angefragt, aber der Contract deklariert kein Geometrie-Feld.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"post":{"summary":"Datensatz anlegen (Neuanlage, Version 1)","description":"Legt einen neuen Datensatz als Version 1 an. Die BOID wird serverseitig deterministisch aus dem Fachschlüssel-Set (primaryKey-Felder) abgeleitet — kein boid im Body. Existiert die abgeleitete BOID schon, ist es ein Konflikt (409); für eine neue Version PUT auf die BOID nutzen.","tags":["Entity API"],"requestBody":{"required":true,"description":"Fields of the record as flat JSON, as the contract defines them.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attributes"}}}},"responses":{"201":{"description":"Datensatz angelegt; Repräsentation der Version 1. Kann der Dienst eine Prüfregel des Vertrags nicht ausführen, ist der Status unverified, und meta.unenforcedRules (flaches JSON: _meta.unenforcedRules) nennt je Regel field, rule und reasonCode: UNSUPPORTED_TYPE, MISSING_IMPLEMENTATION oder ENGINE_NOT_REGISTERED. Was die Codes bedeuten, steht an der Regel in GET /contracts/{id} (enforcementReasonCode, enforcementReason). Einträge mit DESCRIPTIVE, NON_BLOCKING_SEVERITY oder DATASET_SCOPE zählen nicht.","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiDocument"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatRecord"}}}},"409":{"description":"Datensatz mit dieser BOID existiert bereits.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Schemaverletzung (Pflichtfeld/Typ/Enum) oder Fachregel-Verstoß (quality[] je Property, type: custom, JMESPath); Quelle in violations[]: field = Schema, rule = Fachregel.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"400":{"description":"Bad Request"}}}},"/laborprobe/validate":{"post":{"summary":"Datensatz prüfen, ohne ihn zu speichern","description":"Führt dieselben Prüfungen aus wie das Anlegen: Schema, Fachregeln, Verweise (refexists) und die Prüfdienste des Vertrags (phase beforeSave). Gespeichert wird nichts: kein Datensatz, keine Version, kein Ereignis. Ob ein Datensatz mit demselben Fachschlüssel schon existiert (409 beim Anlegen), prüft dieser Aufruf nicht. Verlangt die Stufe write wie das Schreiben.","tags":["Entity API"],"parameters":[{"description":"false: die Prüfdienste (phase beforeSave) nicht aufrufen. Vorgabe true.","name":"beforeSave","in":"query","schema":{"type":"string","default":"true"}}],"requestBody":{"required":true,"description":"Fields of the record as flat JSON, as the contract defines them.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attributes"}}}},"responses":{"200":{"description":"Kein Verstoß. meta.status (flaches JSON: _meta.status) nennt den Status, den der Datensatz beim Speichern erhielte: active oder unverified. Kann der Dienst eine Prüfregel des Vertrags nicht ausführen, ist der Status unverified, und meta.unenforcedRules (flaches JSON: _meta.unenforcedRules) nennt je Regel field, rule und reasonCode: UNSUPPORTED_TYPE, MISSING_IMPLEMENTATION oder ENGINE_NOT_REGISTERED. Was die Codes bedeuten, steht an der Regel in GET /contracts/{id} (enforcementReasonCode, enforcementReason). Einträge mit DESCRIPTIVE, NON_BLOCKING_SEVERITY oder DATASET_SCOPE zählen nicht.","content":{"application/vnd.api+json":{},"application/json":{"schema":{}}}},"400":{"description":"beforeSave ist weder true noch false.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Dieselben Verstöße wie beim Anlegen: Schema, Fachregel oder Abweisung durch einen Prüfdienst; Quelle in violations[]: field = Schema, rule = Fachregel bzw. Name des Prüfdienstes.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"503":{"description":"Ein Prüfdienst ist nicht erreichbar (fail-closed, wie beim Schreiben).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"504":{"description":"Ein Prüfdienst hat nicht rechtzeitig geantwortet (wie beim Schreiben).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/laborprobe/{id}":{"put":{"summary":"Neue Version eines Datensatzes (Komplettersatz, append-only)","description":"Ersetzt den Datensatz vollständig und legt eine neue Version an; vorige Versionen bleiben als Historie erhalten (append-only). {id} muss eine BOID (UUID) sein. Optimistic Locking: If-Match mit dem aktuellen ETag (Version) ist Pflicht — erst GET/HEAD für den ETag, dann PUT. Veraltete Version → 412, fehlender Header → 428.","tags":["Entity API"],"parameters":[{"description":"BOID (UUID) des zu ersetzenden Datensatzes","name":"id","in":"path","required":true,"schema":{"type":"string"}},{"description":"Aktueller ETag (Version) des Datensatzes, z. B. \"3\". Pflicht: erst GET/HEAD für den ETag, dann PUT mit diesem If-Match.","in":"header","name":"If-Match","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"description":"Fields of the record as flat JSON, as the contract defines them.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Attributes"}}}},"responses":{"200":{"description":"Neue Version angelegt; deren Repräsentation. Kann der Dienst eine Prüfregel des Vertrags nicht ausführen, ist der Status unverified, und meta.unenforcedRules (flaches JSON: _meta.unenforcedRules) nennt je Regel field, rule und reasonCode: UNSUPPORTED_TYPE, MISSING_IMPLEMENTATION oder ENGINE_NOT_REGISTERED. Was die Codes bedeuten, steht an der Regel in GET /contracts/{id} (enforcementReasonCode, enforcementReason). Einträge mit DESCRIPTIVE, NON_BLOCKING_SEVERITY oder DATASET_SCOPE zählen nicht.","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiDocument"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatRecord"}}}},"400":{"description":"Ungültiger If-Match-Header (malformt, schwach oder Wildcard).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"404":{"description":"Kein Datensatz zu dieser BOID.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"410":{"description":"Datensatz gelöscht (Tombstone, ADR-014); keine neue Version möglich.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"412":{"description":"If-Match-Version ist nicht die aktuelle (Optimistic Locking).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"428":{"description":"If-Match-Header fehlt (Vorbedingung erforderlich).","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"422":{"description":"Schemaverletzung (Pflichtfeld/Typ/Enum) oder Fachregel-Verstoß (quality[] je Property, type: custom, JMESPath); Quelle in violations[]: field = Schema, rule = Fachregel.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}},"head":{"summary":"Existenz-/Aktivitätsprüfung (200 aktiv, 410 abgelöst, 404 unbekannt) per BOID-UUID oder Identitäts-URN","description":"Prüft ohne Body, ob ein Datensatz existiert und ob er aktiv oder bereits abgelöst ist. ETag und Last-Modified der aktuellen Version tragen als Caching-Grundlage der Prüfung (#136).","tags":["Entity API"],"parameters":[{"description":"BOID (UUID) oder fachliche Identitäts-URN","name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Datensatz existiert und ist aktiv.","content":{"application/json":{"schema":{}}}},"410":{"description":"Datensatz existiert, ist aber nicht aktiv (abgelöst/superseded oder gelöscht/deleted, #145)."},"404":{"description":"Kein Datensatz zu dieser BOID/URN bzw. unbekannter Slug."}}},"get":{"summary":"Aktuelle Version eines Datensatzes (per BOID-UUID oder Identitäts-URN)","description":"Liefert die aktuelle Version eines Datensatzes. Das {id}-Segment ist entweder die BOID (UUID) oder eine fachliche Identitäts-URN, die mandantenstrippend per UUIDv5 in die BOID umgerechnet wird.","tags":["Entity API"],"parameters":[{"description":"BOID (UUID) oder fachliche Identitäts-URN","example":"Schweinepest","name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Aktuelle Version des Datensatzes (JSON:API/Flat-JSON/GeoJSON-Feature).","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiDocument"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatRecord"}}}},"404":{"description":"Kein Datensatz zu dieser BOID/URN bzw. unbekannter Slug.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"406":{"description":"application/geo+json angefragt, aber der Contract deklariert kein Geometrie-Feld.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}},"410":{"description":"Datensatz gelöscht (Tombstone, ADR-014); nur die Metadaten bleiben unter /versions.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/laborprobe/{id}/versions":{"get":{"summary":"Alle Versionen eines Datensatzes","description":"Liefert die vollständige Versionshistorie eines Datensatzes (aktive + abgelöste).","tags":["Entity API"],"parameters":[{"description":"BOID (UUID) des Datensatzes","name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Liste aller Versionen.","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiCollection"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatCollection"}}}},"404":{"description":"Kein Datensatz zu dieser BOID.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}},"/laborprobe/{id}/versions/{n}":{"get":{"summary":"Bestimmte Version eines Datensatzes","description":"Liefert eine konkrete Version eines Datensatzes per 1-basierter Versionsnummer.","tags":["Entity API"],"parameters":[{"description":"BOID (UUID) des Datensatzes","name":"id","in":"path","required":true,"schema":{"type":"string"}},{"description":"1-basierte Versionsnummer","example":1,"name":"n","in":"path","required":true,"schema":{"type":"integer","format":"int32"}}],"responses":{"200":{"description":"Die angeforderte Version des Datensatzes.","content":{"application/vnd.api+json":{"schema":{"$ref":"#/components/schemas/JsonApiDocument"}},"application/json":{"schema":{"$ref":"#/components/schemas/FlatRecord"}}}},"404":{"description":"Kein Datensatz zu dieser BOID oder keine solche Version.","content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/ProblemDetails"}}}}}}}},"info":{"title":"Laborprobe","version":"1.4.0","description":"Referenzimplementierung einer DP-Blueprint-EDP. Walking Skeleton: implementierter Slice + 501-Stubs."},"security":[{"SecurityScheme":[]}]}