Files
cfw-autumn/shared/api/features/apiFeature.ts
John Yeo 9b6f57f872 feat: Add OpenAPI schemas for Features, Entities, Core, and Customers (ENG-628)
- Created operation models and OpenAPI specs for Features (Create, Update, List, Get, Delete)
- Created operation models and OpenAPI specs for Entities (Create, List, Get, Delete)
- Created operation models and OpenAPI specs for Core endpoints (Cancel, Track, Query)
- Created operation models and OpenAPI specs for Customers (Create, Update, List, Get, Delete)
- Fixed bug: Added 'archived' field to UpdateProductV2Params
- Fixed enum usage: Changed z.enum() to z.nativeEnum() for TypeScript enums
- Updated all OpenAPI specs to use requestParams format (path/query with zod schemas)
- Created shared SuccessResponseSchema in common/commonResponses.ts
- Updated models.ts to export all new schemas and OpenAPI operations
- Changed OpenAPI export to JSON format (YAML export has serialization issues with zod schemas)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-02 14:55:58 +01:00

34 lines
629 B
TypeScript

import { z } from "zod/v4";
export enum APIFeatureType {
Boolean = "boolean",
SingleUsage = "single_use",
ContinuousUse = "continuous_use",
CreditSystem = "credit_system",
}
export const APIFeatureSchema = z.object({
id: z.string(),
name: z.string().nullish(),
type: z.nativeEnum(APIFeatureType),
display: z
.object({
singular: z.string(),
plural: z.string(),
})
.nullish(),
credit_schema: z
.array(
z.object({
metered_feature_id: z.string(),
credit_cost: z.number(),
}),
)
.nullish(),
archived: z.boolean().nullish(),
});
export type APIFeature = z.infer<typeof APIFeatureSchema>;