Difficulty: Advanced
Type: DevOps
Background
scripts/sync-api-types.js is described as a "zero-dependency compiler converting openapi.json to typescript types," compiling test/fixtures/openapi.json into lib/api/types.ts, with a companion npm run check-types to validate they still match.
Problem
If guildpass-core ever introduces a /v2 API (a natural evolution given its documented versioning contract) or makes a breaking change to /v1 types, sync-api-types.js and check-types have no described mechanism to detect breaking changes (removed fields, changed types) versus purely additive ones, risking silent type drift or an unhelpfully blunt full-regeneration diff.
Expected outcome
sync-api-types.js supports pointing at multiple OpenAPI fixture files (e.g., a v1 and future v2), generating correctly namespaced types for each, and check-types reports specifically which fields were removed/changed type (breaking) versus added (non-breaking) when the fixture and generated types diverge.
Suggested implementation
- Extend the script's CLI/config to accept an OpenAPI version identifier and output namespaced types (e.g.,
V1Member, V2Member) rather than assuming a single flat type set.
- Implement a structural diff between the previously-generated types and freshly-parsed schema, categorizing changes as additive vs. breaking.
- Update
check-types to print a clear breaking-vs-additive report and exit non-zero only on breaking changes (or on any drift, per current behavior — document the chosen policy).
- Add a test fixture pair (a base
openapi.json and a modified one) exercising both additive and breaking scenarios.
Acceptance criteria
Likely affected files/directories
scripts/sync-api-types.js
test/fixtures/openapi.json
lib/api/types.ts
README.md
Difficulty: Advanced
Type: DevOps
Background
scripts/sync-api-types.jsis described as a "zero-dependency compiler converting openapi.json to typescript types," compilingtest/fixtures/openapi.jsonintolib/api/types.ts, with a companionnpm run check-typesto validate they still match.Problem
If
guildpass-coreever introduces a/v2API (a natural evolution given its documented versioning contract) or makes a breaking change to/v1types,sync-api-types.jsandcheck-typeshave no described mechanism to detect breaking changes (removed fields, changed types) versus purely additive ones, risking silent type drift or an unhelpfully blunt full-regeneration diff.Expected outcome
sync-api-types.jssupports pointing at multiple OpenAPI fixture files (e.g., av1and futurev2), generating correctly namespaced types for each, andcheck-typesreports specifically which fields were removed/changed type (breaking) versus added (non-breaking) when the fixture and generated types diverge.Suggested implementation
V1Member,V2Member) rather than assuming a single flat type set.check-typesto print a clear breaking-vs-additive report and exit non-zero only on breaking changes (or on any drift, per current behavior — document the chosen policy).openapi.jsonand a modified one) exercising both additive and breaking scenarios.Acceptance criteria
check-typesdistinguishes and reports breaking vs. additive schema changesREADME.md's Scripts section updated to describe the new capabilityLikely affected files/directories
scripts/sync-api-types.jstest/fixtures/openapi.jsonlib/api/types.tsREADME.md