Add resourceUUID, organizationUUID and projectUUID OpenAPI schema types#280
Add resourceUUID, organizationUUID and projectUUID OpenAPI schema types#280spjmurray wants to merge 1 commit into
Conversation
|
Claude finished @spjmurray's task in 1m 34s —— View job PR Review CompleteSummaryThis PR does exactly what it claims: it introduces three new UUID-typed schema definitions ( Recommended next step: Approve and merge. This is a clean foundational change that enables future incremental adoption. Detailed AnalysisPros
Cons / Observations
Alignment with PR Summary✅ Perfect alignment. The PR summary states:
The commit message is comprehensive and explains the decision-making clearly. Code Quality
VerdictThis is a well-designed, non-breaking foundational change that sets up future incremental improvements. The PR achieves its stated goal with no downsides. The decision to avoid touching existing fields is pragmatic and shows good understanding of Go module versioning constraints. The only minor gap is test coverage, but that's expected when introducing unused schema definitions. Tests should naturally follow when these types are first consumed. Status: Ready to merge. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #280 +/- ##
==========================================
+ Coverage 33.38% 33.41% +0.02%
==========================================
Files 75 75
Lines 4220 4220
==========================================
+ Hits 1409 1410 +1
Misses 2687 2687
+ Partials 124 123 -1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Introduces three new reusable schema types to the common OpenAPI spec: - resourceUUID: a string with format: uuid (RFC 4122), the canonical type for any resource identifier in the platform - organizationUUID: an alias for resourceUUID, used when a field identifies an organization - projectUUID: an alias for resourceUUID, used when a field identifies a project These types are intentionally not applied to existing metadata fields (id, organizationId, projectId) in this change. Those fields remain plain strings to preserve full backwards compatibility across all consumer repos. Changing them would require every consumer to update at once, since a go.mod bump pulls in all breaking changes regardless of whether the consuming PR needs them. The value of defining these types now is twofold: 1. New API schemas can reference organizationUUID / projectUUID as path parameters immediately, gaining automatic UUID format validation from the OAPI middleware before a handler is ever reached. Invalid IDs are rejected with a 400 at the routing layer rather than propagating into business logic. 2. Handler code that receives these typed path parameters only needs a trivial .String() call to convert back to a string for Kubernetes label lookups — a one-line change per handler that can be done per-repo at any time without coordination. Existing metadata fields can be migrated to these types incrementally in future PRs once consumers are ready, using the *ReadMetadataE pattern for error-returning conversion helpers alongside the existing non-breaking ones. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Summary
resourceUUID(string, format: uuid),organizationUUID, andprojectUUIDas reusable schema types in the common OpenAPI specid,organizationId,projectIdfields on metadata types are left as plain strings — no breaking changes for consumersWhy not change the existing fields?
Changing
id/organizationId/projectIdfromstringtouuid.UUIDwould break every consumer at compile time the moment they bump theirgo.mod— even for an unrelated urgent fix. A Go module bump is all-or-nothing: there is no partial adoption of breaking changes. This approach lets consumers opt in per-repo, per-PR, without coordination.Migration path
organizationUUID/projectUUIDdirectly; the OAPI middleware rejects non-UUID values with a 400 before the handler runs.String()to convert back to a string for Kubernetes label lookups — one line per handler*ReadMetadataEerror-returning helpers in future PRsTest plan
make license validate lintpassesmake test-unitpassestypes.gocontainsResourceUUID,OrganizationUUID,ProjectUUIDas type aliases🤖 Generated with Claude Code