From 79d75a2bd69e25cc77273c159f34a5ee9700a231 Mon Sep 17 00:00:00 2001 From: Jonas Groeger <jonas.groeger_extern@fjd.de> Date: Mon, 8 Jan 2024 16:19:03 +0100 Subject: [PATCH] feat: split authentication tags since replies have required data field (unlike submissions) (planning#460) and since attachment is now used in two places, extract it into a "part" for DRY reasons --- spec/authentication-tags-reply.schema.json | 29 +++++++++++++++++++ ...uthentication-tags-submission.schema.json} | 15 ++++------ spec/parts/attachment.schema.json | 10 +++++++ spec/set-payload.schema.json | 21 ++++++++++---- 4 files changed, 60 insertions(+), 15 deletions(-) create mode 100644 spec/authentication-tags-reply.schema.json rename spec/{authentication-tags.schema.json => authentication-tags-submission.schema.json} (59%) create mode 100644 spec/parts/attachment.schema.json diff --git a/spec/authentication-tags-reply.schema.json b/spec/authentication-tags-reply.schema.json new file mode 100644 index 0000000..6f2637e --- /dev/null +++ b/spec/authentication-tags-reply.schema.json @@ -0,0 +1,29 @@ +{ + "title": "Authentication Tags (Reply)", + "description": "Authentication Tags des Meta- und Fachdatensatzes sowie der Anlagen eines Replies", + "type": "object", + "properties": { + "metadata": { + "$ref": "#/definitions/authenticationTag" + }, + "data": { + "$ref": "#/definitions/authenticationTag" + }, + "attachments": { + "$ref": "#/definitions/attachment" + } + }, + "additionalProperties": false, + "required": [ + "metadata", + "data" + ], + "definitions": { + "authenticationTag": { + "$ref": "./parts/authentication-tag.schema.json" + }, + "attachment": { + "$ref": "./parts/attachment.schema.json" + } + } +} diff --git a/spec/authentication-tags.schema.json b/spec/authentication-tags-submission.schema.json similarity index 59% rename from spec/authentication-tags.schema.json rename to spec/authentication-tags-submission.schema.json index ccbdbbd..c3bba92 100644 --- a/spec/authentication-tags.schema.json +++ b/spec/authentication-tags-submission.schema.json @@ -1,6 +1,6 @@ { - "title": "Authentication Tags", - "description": "Authentication Tags des Meta- und Fachdatensatzes sowie der Anlagen", + "title": "Authentication Tags (Submission)", + "description": "Authentication Tags des Meta- und Fachdatensatzes sowie der Anlagen einer Submission.", "type": "object", "properties": { "metadata": { @@ -10,13 +10,7 @@ "$ref": "#/definitions/authenticationTag" }, "attachments": { - "type": "object", - "patternProperties": { - "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$": { - "$ref": "#/definitions/authenticationTag" - } - }, - "additionalProperties": false + "$ref": "#/definitions/attachment" } }, "additionalProperties": false, @@ -26,6 +20,9 @@ "definitions": { "authenticationTag": { "$ref": "./parts/authentication-tag.schema.json" + }, + "attachment": { + "$ref": "./parts/attachment.schema.json" } } } diff --git a/spec/parts/attachment.schema.json b/spec/parts/attachment.schema.json new file mode 100644 index 0000000..dc32f3a --- /dev/null +++ b/spec/parts/attachment.schema.json @@ -0,0 +1,10 @@ +{ + "title": "Attachment", + "type": "object", + "patternProperties": { + "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$": { + "$ref": "./authentication-tag.schema.json" + } + }, + "additionalProperties": false +} diff --git a/spec/set-payload.schema.json b/spec/set-payload.schema.json index f24374b..6da77a8 100644 --- a/spec/set-payload.schema.json +++ b/spec/set-payload.schema.json @@ -47,7 +47,7 @@ "type": "object", "properties": { "authenticationTags": { - "$ref": "#/$defs/authenticationTags" + "$ref": "#/$defs/authenticationTagsSubmission" } }, "required": [ @@ -95,7 +95,7 @@ "$ref": "#/$defs/problems" }, "authenticationTags": { - "$ref": "#/$defs/authenticationTags" + "$ref": "#/$defs/authenticationTagsSubmission" } }, "required": [ @@ -115,7 +115,7 @@ "type": "object", "properties": { "authenticationTags": { - "$ref": "#/$defs/authenticationTags" + "$ref": "#/$defs/authenticationTagsReply" } }, "required": [ @@ -158,7 +158,7 @@ "$ref": "#/$defs/problems" }, "authenticationTags": { - "$ref": "#/$defs/authenticationTags" + "$ref": "#/$defs/authenticationTagsReply" } }, "required": [ @@ -186,11 +186,20 @@ "events" ], "$defs": { - "authenticationTags": { - "$ref": "./authentication-tags.schema.json" + "authenticationTagsSubmission": { + "$ref": "./authentication-tags-submission.schema.json" + }, + "authenticationTagsReply": { + "$ref": "./authentication-tags-reply.schema.json" }, "problems": { "$ref": "./problems.schema.json" + }, + "authenticationTag": { + "$ref": "./parts/authentication-tag.schema.json" + }, + "attachment": { + "$ref": "./parts/attachment.schema.json" } } } -- GitLab