From 3e11be8cbe4d2545d7317b2ee72bac2a27045b2e Mon Sep 17 00:00:00 2001 From: Harriet H-W Date: Thu, 7 Nov 2024 14:56:48 +0000 Subject: [PATCH] add `instructions_for_publishers` to Content Block schemas We want to add a field to all Content Blocks that will be a short string containing an internal-only message. This adds the field `instructions_for_publishers` to a shared definitions file, and then uses it in the email and postal address schemas. As this is a Content Block specific field, it doesn't necessarily make sense to add it to the shared default-format, so if I understand the schema process correctly we can only add it to the details key. --- .../content_block_email_address/notification/schema.json | 8 ++++++++ .../content_block_email_address/publisher_v2/schema.json | 8 ++++++++ .../content_block_postal_address/notification/schema.json | 8 ++++++++ .../content_block_postal_address/publisher_v2/schema.json | 8 ++++++++ .../content_block_email_address/publisher_v2/example.json | 2 +- .../formats/content_block_email_address.jsonnet | 5 ++++- .../formats/content_block_postal_address.jsonnet | 5 ++++- .../shared/definitions/_content_block_manager.jsonnet | 7 +++++++ 8 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 content_schemas/formats/shared/definitions/_content_block_manager.jsonnet diff --git a/content_schemas/dist/formats/content_block_email_address/notification/schema.json b/content_schemas/dist/formats/content_block_email_address/notification/schema.json index 16b1cb2e1..ff43aac64 100644 --- a/content_schemas/dist/formats/content_block_email_address/notification/schema.json +++ b/content_schemas/dist/formats/content_block_email_address/notification/schema.json @@ -386,6 +386,9 @@ "email_address": { "type": "string", "format": "email" + }, + "instructions_for_publishers": { + "$ref": "#/definitions/instructions_for_publishers" } } }, @@ -544,6 +547,11 @@ }, "uniqueItems": true }, + "instructions_for_publishers": { + "description": "An internal message to be added to content blocks", + "type": "string", + "additionalProperties": false + }, "locale": { "type": "string", "enum": [ diff --git a/content_schemas/dist/formats/content_block_email_address/publisher_v2/schema.json b/content_schemas/dist/formats/content_block_email_address/publisher_v2/schema.json index e97891481..520940def 100644 --- a/content_schemas/dist/formats/content_block_email_address/publisher_v2/schema.json +++ b/content_schemas/dist/formats/content_block_email_address/publisher_v2/schema.json @@ -200,6 +200,9 @@ "email_address": { "type": "string", "format": "email" + }, + "instructions_for_publishers": { + "$ref": "#/definitions/instructions_for_publishers" } } }, @@ -219,6 +222,11 @@ }, "uniqueItems": true }, + "instructions_for_publishers": { + "description": "An internal message to be added to content blocks", + "type": "string", + "additionalProperties": false + }, "locale": { "type": "string", "enum": [ diff --git a/content_schemas/dist/formats/content_block_postal_address/notification/schema.json b/content_schemas/dist/formats/content_block_postal_address/notification/schema.json index caec5d815..6125aa3ac 100644 --- a/content_schemas/dist/formats/content_block_postal_address/notification/schema.json +++ b/content_schemas/dist/formats/content_block_postal_address/notification/schema.json @@ -388,6 +388,9 @@ "county": { "type": "string" }, + "instructions_for_publishers": { + "$ref": "#/definitions/instructions_for_publishers" + }, "line_1": { "type": "string" }, @@ -557,6 +560,11 @@ }, "uniqueItems": true }, + "instructions_for_publishers": { + "description": "An internal message to be added to content blocks", + "type": "string", + "additionalProperties": false + }, "locale": { "type": "string", "enum": [ diff --git a/content_schemas/dist/formats/content_block_postal_address/publisher_v2/schema.json b/content_schemas/dist/formats/content_block_postal_address/publisher_v2/schema.json index 2971a88ee..030b8393a 100644 --- a/content_schemas/dist/formats/content_block_postal_address/publisher_v2/schema.json +++ b/content_schemas/dist/formats/content_block_postal_address/publisher_v2/schema.json @@ -202,6 +202,9 @@ "county": { "type": "string" }, + "instructions_for_publishers": { + "$ref": "#/definitions/instructions_for_publishers" + }, "line_1": { "type": "string" }, @@ -232,6 +235,11 @@ }, "uniqueItems": true }, + "instructions_for_publishers": { + "description": "An internal message to be added to content blocks", + "type": "string", + "additionalProperties": false + }, "locale": { "type": "string", "enum": [ diff --git a/content_schemas/examples/content_block_email_address/publisher_v2/example.json b/content_schemas/examples/content_block_email_address/publisher_v2/example.json index adc9db3ec..29405e255 100644 --- a/content_schemas/examples/content_block_email_address/publisher_v2/example.json +++ b/content_schemas/examples/content_block_email_address/publisher_v2/example.json @@ -3,9 +3,9 @@ "schema_name": "content_block_email_address", "document_type": "content_block_email_address", "title": "Government Digital Service - General contact", - "description": "General contact email address for Government Digital Service", "content_id_alias": "gds-general", "details": { + "instructions_for_publishers": "General contact email address for Government Digital Service", "email_address": "foo@example.com" }, "links": { diff --git a/content_schemas/formats/content_block_email_address.jsonnet b/content_schemas/formats/content_block_email_address.jsonnet index ba7d982bb..2d150bdad 100644 --- a/content_schemas/formats/content_block_email_address.jsonnet +++ b/content_schemas/formats/content_block_email_address.jsonnet @@ -1,6 +1,6 @@ (import "shared/content_block.jsonnet") + { document_type: "content_block_email_address", - definitions: { + definitions: (import "shared/definitions/_content_block_manager.jsonnet") + { details: { type: "object", additionalProperties: false, @@ -10,6 +10,9 @@ type: "string", format: "email", }, + instructions_for_publishers: { + "$ref": "#/definitions/instructions_for_publishers", + } }, }, }, diff --git a/content_schemas/formats/content_block_postal_address.jsonnet b/content_schemas/formats/content_block_postal_address.jsonnet index 848700728..708832f26 100644 --- a/content_schemas/formats/content_block_postal_address.jsonnet +++ b/content_schemas/formats/content_block_postal_address.jsonnet @@ -1,6 +1,6 @@ (import "shared/content_block.jsonnet") + { document_type: "content_block_postal_address", - definitions: { + definitions: (import "shared/definitions/_content_block_manager.jsonnet") + { details: { type: "object", additionalProperties: false, @@ -21,6 +21,9 @@ postcode: { type: "string" }, + instructions_for_publishers: { + "$ref": "#/definitions/instructions_for_publishers", + } }, }, }, diff --git a/content_schemas/formats/shared/definitions/_content_block_manager.jsonnet b/content_schemas/formats/shared/definitions/_content_block_manager.jsonnet new file mode 100644 index 000000000..8a860f7ee --- /dev/null +++ b/content_schemas/formats/shared/definitions/_content_block_manager.jsonnet @@ -0,0 +1,7 @@ + { + instructions_for_publishers: { + description: "An internal message to be added to content blocks", + type: "string", + additionalProperties: false, + } + } \ No newline at end of file