Skip to content

fix(types): improve PatchOperation specificity#60

Open
tris203 wants to merge 1 commit into
covenanttechnologysolutions:masterfrom
tris203:review/patchoperation-specificity
Open

fix(types): improve PatchOperation specificity#60
tris203 wants to merge 1 commit into
covenanttechnologysolutions:masterfrom
tris203:review/patchoperation-specificity

Conversation

@tris203

@tris203 tris203 commented May 29, 2026

Copy link
Copy Markdown

Changes

  • Generates components.schemas.PatchOperation as a discriminated union from the Manage OpenAPI schema.
  • Requires value for add and replace operations.
  • Allows remove operations to omit value.
  • Constrains op to valid patch operation values: add, replace, and remove.
  • Updates the public ManageAPI PatchOperation export to reference the generated schema type, keeping a single source of truth.
  • Adds type tests covering valid and invalid patch operation shapes.

Why

The previous PatchOperation type allowed overly broad or inaccurate shapes, including unconstrained op values and optional/incorrectly typed fields. This change makes the public API safer and better aligned with expected patch semantics.

Generate PatchOperation as a discriminated union from the Manage OpenAPI schema so add and replace operations require a value while remove may omit it.

Alias the public ManageAPI PatchOperation export to the generated schema type to keep a single source of truth, and add type tests for the accepted and rejected operation shapes.
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.

1 participant