Skip to content

CCM-8579: Switch from util types to api client types#332

Merged
ClareJonesBJSS merged 15 commits intomainfrom
feature/CCM-8579_generated-type-inheritance
Mar 13, 2025
Merged

CCM-8579: Switch from util types to api client types#332
ClareJonesBJSS merged 15 commits intomainfrom
feature/CCM-8579_generated-type-inheritance

Conversation

@ClareJonesBJSS
Copy link
Contributor

@ClareJonesBJSS ClareJonesBJSS commented Mar 6, 2025

Description

Rewrites the API spec to take advantage of anyOf/oneOf to avoid having all channel-specific properties as optional properties on a single object, and removes util types in favour of the generated ones.

  • Switches generators as the current one is unsupported and had some bugs I could only work around by structuring things weirdly and/or a post generation transform step
  • Switches to unions over enums

Context

On creating the letter create/update pages, I went through a lot of silly mistakes and stray properties that TS could have caught, along with little discrepancies where the generated types and nhs-notify-web-template-management-utils types/validations had diverged. Consolidating on TemplateDto gives a lot more confidence that types actually reflect reality at runtime and will be accepted by the API

Testing

Manually tested SMS/email/NHS app template creation, editing, copying, deleting and submitting and all executed successfully with no visible regression. Letters seem to be working well so far for my follow on work and Alex's backend work at #340

Screenshot 2025-03-07 at 12-30-28 NHS Notify - Template Management
Screenshot 2025-03-07 at 12-31-36 NHS Notify - Template Management
Screenshot 2025-03-07 at 12-31-58 NHS Notify - Template Management
Screenshot 2025-03-07 at 12-32-25 NHS Notify - Template Management
Screenshot 2025-03-07 at 12-32-39 NHS Notify - Template Management
Screenshot 2025-03-07 at 12-33-08 NHS Notify - Template Management
Screenshot 2025-03-12 at 17 01 26

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.

@ClareJonesBJSS ClareJonesBJSS requested a review from a team as a code owner March 6, 2025 08:20
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch from 8d68237 to 4fc6f88 Compare March 6, 2025 08:22
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch 4 times, most recently from a290c2d to 8ba4552 Compare March 6, 2025 16:05
@ClareJonesBJSS ClareJonesBJSS requested a review from a team as a code owner March 7, 2025 09:27
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch 7 times, most recently from 5f70ddc to ce133f3 Compare March 7, 2025 16:56
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch from ce133f3 to 8cc9990 Compare March 7, 2025 17:14
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch from 8cc9990 to 879c009 Compare March 9, 2025 15:01
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch 2 times, most recently from 8bdd9da to a24efaf Compare March 10, 2025 09:13
@ClareJonesBJSS ClareJonesBJSS force-pushed the feature/CCM-8579_generated-type-inheritance branch from a727bdf to 9d4a431 Compare March 10, 2025 18:45
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.

5 participants