updated openapi for api customer
This commit is contained in:
@@ -55,11 +55,7 @@ export const customersOpenApi = {
|
||||
description: "200 OK",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: createPagePaginatedResponseSchema(
|
||||
BaseApiCustomerSchema,
|
||||
).meta({
|
||||
id: "CustomerListResponse",
|
||||
}),
|
||||
schema: createPagePaginatedResponseSchema(BaseApiCustomerSchema),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -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: {
|
||||
|
||||
@@ -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<typeof CustomerDataSchema>;
|
||||
|
||||
@@ -32,7 +32,9 @@ export const createPagePaginatedResponseSchema = <T extends z.ZodType>(
|
||||
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"),
|
||||
|
||||
@@ -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(),
|
||||
|
||||
Reference in New Issue
Block a user