Skip to content

CCM-10257: Implement Eventpub in Core - Schema Validation#85

Merged
jamesthompson26-nhs merged 5 commits intomainfrom
feature/CCM-10257_Implement_Eventpub_in_Core_Schema_Validation
Jun 10, 2025
Merged

CCM-10257: Implement Eventpub in Core - Schema Validation#85
jamesthompson26-nhs merged 5 commits intomainfrom
feature/CCM-10257_Implement_Eventpub_in_Core_Schema_Validation

Conversation

@jamesthompson26-nhs
Copy link
Copy Markdown
Contributor

Description

Validates the incoming event against the schema from CCM-10197:

{
  "$schema": "https://notify.nhs.uk/events/schemas/supplier-status/v1.json",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid",
      "description": "Unique ID for this event"
    },
    "source": {
      "type": "string",
      "description": "Source of the event"
    },
    "specversion": {
      "type": "string",
      "description": "Version of the event"
    },
    "type": {
      "type": "string",
      "description": "Type of event"
    },
    "subject": {
      "type": "string",
      "format": "uuid",
      "description": "Original item plan ID"
    },
    "time": {
      "type": "string",
      "description": "Time the event was generated"
    },
    "datacontenttype": {
      "type": "string",
      "description": "Always application/json"
    },
    "dataschema": {
      "type": "string",
      "description": "Schema for this event"
    },
    "dataschemaversion": {
      "type": "string",
      "description": "Version of the schema"
    },
    "data": {
      "type": "object",
      "properties": {
        "nhsNumber": {
          "type": "string",
          "description": "Patient NHS number"
        },
        "delayedFallback": {
          "type": "boolean",
          "description": "Whether or not delayed fallback is enabled"
        },
        "sendingGroupId": {
          "type": "string",
          "description": "Sending group ID"
        },
        "clientId": {
          "type": "string",
          "description": "Client ID for the original message"
        },
        "campaignId": {
          "type": "string",
          "description": "Campaign ID for the original message"
        },
        "supplierStatus": {
          "type": "string",
          "description": "New supplier status"
        },
        "previousSupplierStatus": {
          "type": "string",
          "description": "Previous supplier status"
        }
      },
      "required": [
        "nhsNumber",
        "delayedFallback",
        "sendingGroupId",
        "clientId",
        "campaignId",
        "supplierStatus",
        "previousSupplierStatus"
      ]
    }
  },
  "required": [
    "id",
    "source",
    "specversion",
    "type",
    "subject",
    "time",
    "datacontenttype",
    "dataschema",
    "dataschemaversion",
    "data"
  ]
}

Context

Type of changes

  • Refactoring (non-breaking change)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would change existing functionality)
  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • I am familiar with the contributing guidelines
  • I have followed the code style of the project
  • I have added tests to cover my changes
  • I have updated the documentation accordingly
  • This PR is a result of pair or mob programming

Sensitive Information Declaration

To ensure the utmost confidentiality and protect your and others privacy, we kindly ask you to NOT including PII (Personal Identifiable Information) / PID (Personal Identifiable Data) or any other sensitive data in this PR (Pull Request) and the codebase changes. We will remove any PR that do contain any sensitive information. We really appreciate your cooperation in this matter.

  • I confirm that neither PII/PID nor sensitive data are included in this PR and the codebase changes.

@jamesthompson26-nhs jamesthompson26-nhs force-pushed the feature/CCM-10257_Implement_Eventpub_in_Core_Schema_Validation branch from bf79a2d to 4664b2d Compare June 10, 2025 08:34
sidnhs
sidnhs previously approved these changes Jun 10, 2025
Comment thread infrastructure/modules/eventpub/lambda/eventpub/src/__tests__/index.test.js Outdated
Comment thread infrastructure/modules/eventpub/lambda/eventpub/src/__tests__/index.test.js Outdated
@jamesthompson26-nhs jamesthompson26-nhs added this pull request to the merge queue Jun 10, 2025
Merged via the queue into main with commit 6db6311 Jun 10, 2025
26 checks passed
@jamesthompson26-nhs jamesthompson26-nhs deleted the feature/CCM-10257_Implement_Eventpub_in_Core_Schema_Validation branch June 10, 2025 10:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants