feat(contracts): openapi base, error codes, type generation

Co-Authored-By: Claude Code <noreply@anthropic.com>
This commit is contained in:
浅念
2026-09-17 17:04:12 +08:00
parent 9dc530feaf
commit 656498d748
10 changed files with 4360 additions and 8 deletions
@@ -0,0 +1,15 @@
// 占位冒烟测试:仅验证 jest + ts-jest 工具链可用(Task 6 落地真正的类型测试)。
import { ErrorCodes, type ErrorCode } from '../errors.js';
describe('ErrorCodes', () => {
it('每个 key 映射到同名的稳定 code 字符串', () => {
for (const [key, code] of Object.entries(ErrorCodes)) {
expect(key).toBe(code);
}
});
it('ErrorCode 联合类型可收窄具体 code', () => {
const code: ErrorCode = ErrorCodes.ALBUM_NOT_FOUND;
expect(code).toBe('ALBUM_NOT_FOUND');
});
});