diff --git a/shared/api/_openapi2.0_/customersOpenApi.ts b/shared/api/_openapi2.0_/customersOpenApi.ts index 224c6e8d6..328dcb0cd 100644 --- a/shared/api/_openapi2.0_/customersOpenApi.ts +++ b/shared/api/_openapi2.0_/customersOpenApi.ts @@ -55,11 +55,7 @@ export const customersOpenApi = { description: "200 OK", content: { "application/json": { - schema: createPagePaginatedResponseSchema( - BaseApiCustomerSchema, - ).meta({ - id: "CustomerListResponse", - }), + schema: createPagePaginatedResponseSchema(BaseApiCustomerSchema), }, }, }, diff --git a/shared/api/_openapi2.0_/openapi2.0.ts b/shared/api/_openapi2.0_/openapi2.0.ts index a92d7f84f..9a8e23802 100644 --- a/shared/api/_openapi2.0_/openapi2.0.ts +++ b/shared/api/_openapi2.0_/openapi2.0.ts @@ -3,7 +3,11 @@ import { ApiPlanFeatureWithMeta } from "@api/products/planFeature/apiPlanFeature import yaml from "yaml"; import { createDocument } from "zod-openapi"; import { CustomerDataSchema } from "../common/customerData.js"; -import { ApiCustomerSchema, EntityDataSchema } from "../models.js"; +import { + ApiCustomerSchema, + BaseApiCustomerSchema, + EntityDataSchema, +} from "../models.js"; import { balancesOpenApi } from "./balancesOpenApi.js"; import { coreOps } from "./coreOpenApi.js"; import { customersOpenApi } from "./customersOpenApi.js"; @@ -39,6 +43,7 @@ const openapi2_0 = createDocument( Plan: ApiPlanWithMeta, PlanFeature: ApiPlanFeatureWithMeta, Customer: ApiCustomerSchema, + BaseCustomer: BaseApiCustomerSchema, Entity: ApiEntityWithMeta, }, securitySchemes: { diff --git a/shared/api/common/customerData.ts b/shared/api/common/customerData.ts index 8894e86c8..9f82a5185 100644 --- a/shared/api/common/customerData.ts +++ b/shared/api/common/customerData.ts @@ -25,8 +25,7 @@ export const CustomerDataSchema = z }) .meta({ id: "CustomerData", - description: - "Unique identifier (eg, serial number) to detect duplicate customers and prevent free trial abuse", + description: "Customer details to set when creating a customer", }); export type CustomerData = z.infer; diff --git a/shared/api/common/pagePaginationSchemas.ts b/shared/api/common/pagePaginationSchemas.ts index 59d095848..183bf01d3 100644 --- a/shared/api/common/pagePaginationSchemas.ts +++ b/shared/api/common/pagePaginationSchemas.ts @@ -32,7 +32,9 @@ export const createPagePaginatedResponseSchema = ( itemSchema: T, ) => z.object({ - list: z.array(itemSchema).describe("Array of items for current page"), + list: z.array(itemSchema).meta({ + description: "Array of items for current page", + }), has_more: z .boolean() .describe("Whether more results exist after this page"), diff --git a/shared/api/customers/apiCustomer.ts b/shared/api/customers/apiCustomer.ts index 7830f4941..7bec9928e 100644 --- a/shared/api/customers/apiCustomer.ts +++ b/shared/api/customers/apiCustomer.ts @@ -20,7 +20,9 @@ export const ApiCusExpandSchema = z.object({ export const BaseApiCustomerSchema = z .object({ - autumn_id: z.string().optional(), + autumn_id: z.string().optional().meta({ + internal: true, + }), id: z.string().nullable(), name: z.string().nullable(), email: z.string().nullable(),