UNPKG

@autobe/agent

Version:

AI backend server code generator

539 lines 334 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; var desc = Object.getOwnPropertyDescriptor(m, k); if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { desc = { enumerable: true, get: function() { return m[k]; } }; } Object.defineProperty(o, k2, desc); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || (function () { var ownKeys = function(o) { ownKeys = Object.getOwnPropertyNames || function (o) { var ar = []; for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k; return ar; }; return ownKeys(o); }; return function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]); __setModuleDefault(result, mod); return result; }; })(); var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.orchestrateInterfaceOperation = orchestrateInterfaceOperation; const __typia_transform__validateReport = __importStar(require("typia/lib/internal/_validateReport.js")); const __typia_transform__llmApplicationFinalize = __importStar(require("typia/lib/internal/_llmApplicationFinalize.js")); const utils_1 = require("@autobe/utils"); const tstl_1 = require("tstl"); const typia_1 = __importDefault(require("typia")); const NamingConvention_1 = require("typia/lib/utils/NamingConvention"); const uuid_1 = require("uuid"); const assertSchemaModel_1 = require("../../context/assertSchemaModel"); const divideArray_1 = require("../../utils/divideArray"); const executeCachedBatch_1 = require("../../utils/executeCachedBatch"); const AutoBePreliminaryController_1 = require("../common/AutoBePreliminaryController"); const transformInterfaceOperationHistory_1 = require("./histories/transformInterfaceOperationHistory"); const orchestrateInterfaceOperationReview_1 = require("./orchestrateInterfaceOperationReview"); const OperationValidator_1 = require("./utils/OperationValidator"); function orchestrateInterfaceOperation(ctx, props) { return __awaiter(this, void 0, void 0, function* () { const matrix = (0, divideArray_1.divideArray)({ array: props.endpoints, capacity: 2 /* AutoBeConfigConstant.INTERFACE_CAPACITY */, }); const progress = { total: matrix.flat().length, completed: 0, }; const reviewProgress = { total: matrix.length, completed: 0, }; return (yield (0, executeCachedBatch_1.executeCachedBatch)(ctx, matrix.map((it) => (promptCacheKey) => __awaiter(this, void 0, void 0, function* () { const row = yield divideAndConquer(ctx, { endpoints: it, progress, reviewProgress, promptCacheKey, instruction: props.instruction, }); return row; })))).flat(); }); } function divideAndConquer(ctx, props) { return __awaiter(this, void 0, void 0, function* () { const remained = new tstl_1.HashSet(props.endpoints, utils_1.AutoBeOpenApiEndpointComparator.hashCode, utils_1.AutoBeOpenApiEndpointComparator.equals); const unique = new tstl_1.HashMap(utils_1.AutoBeOpenApiEndpointComparator.hashCode, utils_1.AutoBeOpenApiEndpointComparator.equals); for (let i = 0; i < ctx.retry; ++i) { if (remained.empty() === true || unique.size() >= props.endpoints.length) break; const operations = remained.size() ? yield process(ctx, { endpoints: remained, progress: props.progress, promptCacheKey: props.promptCacheKey, instruction: props.instruction, }) : []; for (const item of operations) { unique.set(item, item); remained.erase(item); } } const newbie = yield (0, orchestrateInterfaceOperationReview_1.orchestrateInterfaceOperationReview)(ctx, unique.toJSON().map((it) => it.second), props.reviewProgress); for (const item of newbie) unique.set(item, item); return unique.toJSON().map((it) => it.second); }); } function process(ctx, props) { return __awaiter(this, void 0, void 0, function* () { const prefix = NamingConvention_1.NamingConvention.camel(ctx.state().analyze.prefix); const preliminary = new AutoBePreliminaryController_1.AutoBePreliminaryController({ application: { version: "3.1", components: { schemas: { "IAutoBeInterfaceOperationApplication.IProps": { type: "object", properties: { thinking: { type: "string", description: "Think before you act.\n\nBefore requesting preliminary data or completing your task, reflect on your\ncurrent state and explain your reasoning:\n\nFor preliminary requests (getAnalysisFiles, getPrismaSchemas, etc.):\n- What critical information is missing that you don't already have?\n- Why do you need it specifically right now?\n- Be brief - state the gap, don't list everything you have.\n\nFor completion (complete):\n- What key assets did you acquire?\n- What did you accomplish?\n- Why is it sufficient to complete?\n- Summarize - don't enumerate every single item.\n\nThis reflection helps you avoid duplicate requests and premature completion." }, request: { oneOf: [ { $ref: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles" }, { $ref: "#/components/schemas/IAutoBePreliminaryGetPrismaSchemas" }, { $ref: "#/components/schemas/IAutoBeInterfaceOperationApplication.IComplete" } ], discriminator: { propertyName: "type", mapping: { getAnalysisFiles: "#/components/schemas/IAutoBePreliminaryGetAnalysisFiles", getPrismaSchemas: "#/components/schemas/IAutoBePreliminaryGetPrismaSchemas", complete: "#/components/schemas/IAutoBeInterfaceOperationApplication.IComplete" } }, description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval\n(getAnalysisFiles, getPrismaSchemas) or final operation generation\n(complete). When preliminary returns empty array, that type is removed\nfrom the union, physically preventing repeated calls." } }, required: [ "thinking", "request" ] }, IAutoBePreliminaryGetAnalysisFiles: { type: "object", properties: { type: { "const": "getAnalysisFiles", description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getAnalysisFiles\" indicates this is a preliminary\ndata request for analysis files." }, fileNames: { type: "array", items: { type: "string" }, minItems: 1, description: "List of analysis file names to retrieve.\n\nFile names from the analyze phase containing requirements, use cases, and\nbusiness logic documentation.\n\nCRITICAL: DO NOT request the same file names that you have already\nrequested in previous calls." } }, required: [ "type", "fileNames" ], description: "Request to retrieve requirements analysis files for context.\n\nThis type is used in the preliminary phase to request specific analysis files\nthat provide business requirements and domain context." }, IAutoBePreliminaryGetPrismaSchemas: { type: "object", properties: { type: { "const": "getPrismaSchemas", description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"getPrismaSchemas\" indicates this is a preliminary\ndata request for Prisma schemas." }, schemaNames: { type: "array", items: { type: "string" }, minItems: 1, description: "List of Prisma table names to retrieve.\n\nTable names from the Prisma schema file representing database entities\n(e.g., \"user\", \"post\", \"comment\").\n\nCRITICAL: DO NOT request the same schema names that you have already\nrequested in previous calls." } }, required: [ "type", "schemaNames" ], description: "Request to retrieve Prisma database schema definitions for context.\n\nThis type is used in the preliminary phase to request specific Prisma table\nschemas needed for generating type-safe API operations." }, "IAutoBeInterfaceOperationApplication.IComplete": { type: "object", properties: { type: { "const": "complete", description: "Type discriminator for the request.\n\nDetermines which action to perform: preliminary data retrieval or actual\ntask execution. Value \"complete\" indicates this is the final task\nexecution request." }, operations: { type: "array", items: { $ref: "#/components/schemas/IAutoBeInterfaceOperationApplication.IOperation" }, description: "Array of API operations to generate.\n\nEach operation in this array includes:\n\n- Specification: Detailed API specification with clear purpose and\n functionality\n- Path: Resource-centric URL path (e.g., \"/resources/{resourceId}\")\n- Method: HTTP method (get, post, put, delete, patch)\n- Description: Extremely detailed multi-paragraph description referencing\n Prisma schema comments\n- Summary: Concise one-sentence summary of the endpoint\n- Parameters: Array of all necessary parameters with descriptions and\n schema definitions\n- RequestBody: For POST/PUT/PATCH methods, with typeName referencing\n components.schemas\n- ResponseBody: With typeName referencing appropriate response type\n\nAll operations follow strict quality standards:\n\n1. Detailed descriptions referencing Prisma schema comments\n2. Accurate parameter definitions matching path parameters\n3. Appropriate request/response body type references\n4. Consistent patterns for CRUD operations\n\nFor list retrievals (typically PATCH), include pagination, search, and\nsorting. For detail retrieval (GET), return a single resource. For\ncreation (POST), use .ICreate request body. For modification (PUT), use\n.IUpdate request body." } }, required: [ "type", "operations" ], description: "Request to generate detailed API operations.\n\nExecutes operation generation to create complete API operations following\nREST principles and quality standards. Each operation includes specification,\npath, method, detailed description, summary, parameters, and request/response\nbodies." }, "IAutoBeInterfaceOperationApplication.IOperation": { type: "object", properties: { specification: { type: "string", description: "Specification of the API operation.\n\nBefore defining the API operation interface, please describe what you're\nplanning to write in this `specification` field.\n\nThe specification must be fully detailed and clear, so that anyone can\nunderstand the purpose and functionality of the API operation and its\nrelated components (e.g., {@link path}, {@link parameters},\n{@link requestBody}).\n\nIMPORTANT: The specification MUST identify which Prisma DB table this\noperation is associated with, helping ensure complete coverage of all\ndatabase entities." }, description: { type: "string", description: "Detailed description about the API operation.\n\nIMPORTANT: This field MUST be extensively detailed and MUST reference the\ndescription comments from the related Prisma DB schema tables and\ncolumns. The description should be organized into MULTIPLE PARAGRAPHS\nseparated by line breaks to improve readability and comprehension.\n\nFor example, include separate paragraphs for:\n\n- The purpose and overview of the API operation\n- Security considerations and user permissions\n- Relationship to underlying database entities\n- Validation rules and business logic\n- Related API operations that might be used together with this one\n- Expected behavior and error handling\n\nWhen writing the description, be sure to incorporate the corresponding DB\nschema's description comments, matching the level of detail and style of\nthose comments. This ensures consistency between the API documentation\nand database structure.\n\nIf there's a dependency to other APIs, please describe the dependency API\noperation in this field with detailed reason. For example, if this API\noperation needs a pre-execution of other API operation, it must be\nexplicitly described.\n\n- `GET /shoppings/customers/sales` must be pre-executed to get entire list\n of summarized sales. Detailed sale information would be obtained by\n specifying the sale ID in the path parameter.\n\n**CRITICAL WARNING about soft delete keywords**: DO NOT use terms like\n\"soft delete\", \"soft-delete\", or similar variations in this description\nUNLESS the operation actually implements soft deletion. These keywords\ntrigger validation logic that expects a corresponding soft_delete_column\nto be specified. Only use these terms when you intend to implement soft\ndeletion (marking records as deleted without removing them from the\ndatabase).\n\nExample of problematic description: \u274C \"This would normally be a\nsoft-delete, but we intentionally perform permanent deletion here\" - This\ntriggers soft delete validation despite being a hard delete operation.\n\n> MUST be written in English. Never use other languages." }, summary: { type: "string", description: "Short summary of the API operation.\n\nThis should be a concise description of the API operation, typically one\nsentence long. It should provide a quick overview of what the API does\nwithout going into too much detail.\n\nThis summary will be used in the OpenAPI documentation to give users a\nquick understanding of the API operation's purpose.\n\nIMPORTANT: The summary should clearly indicate which Prisma DB table this\noperation relates to, helping to ensure all tables have API coverage.\n\n**CRITICAL WARNING about soft delete keywords**: DO NOT use terms like\n\"soft delete\", \"soft-delete\", or similar variations in this summary\nUNLESS the operation actually implements soft deletion. These keywords\ntrigger validation logic that expects a corresponding soft_delete_column\nto be specified. Only use these terms when you intend to implement soft\ndeletion (marking records as deleted without removing them from the\ndatabase).\n\n> MUST be written in English. Never use other languages" }, parameters: { type: "array", items: { $ref: "#/components/schemas/AutoBeOpenApi.IParameter" }, description: "List of path parameters.\n\nNote that, the {@link AutoBeOpenApi.IParameter.name identifier name} of\npath parameter must be corresponded to the\n{@link path API operation path}.\n\nFor example, if there's an API operation which has {@link path} of\n`/shoppings/customers/sales/{saleId}/questions/${questionId}/comments/${commentId}`,\nits list of {@link AutoBeOpenApi.IParameter.name path parameters} must be\nlike:\n\n- `saleId`\n- `questionId`\n- `commentId`" }, requestBody: { oneOf: [ { type: "null" }, { $ref: "#/components/schemas/AutoBeOpenApi.IRequestBody" } ], description: "Request body of the API operation.\n\nDefines the payload structure for the request. Contains a description and\nschema reference to define the expected input data.\n\nShould be `null` for operations that don't require a request body, such\nas most \"get\" operations." }, responseBody: { oneOf: [ { type: "null" }, { $ref: "#/components/schemas/AutoBeOpenApi.IResponseBody" } ], description: "Response body of the API operation.\n\nDefines the structure of the successful response data. Contains a\ndescription and schema reference for the returned data.\n\nShould be null for operations that don't return any data." }, name: { type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", description: "Functional name of the API endpoint.\n\nThis is a semantic identifier that represents the primary function or\npurpose of the API endpoint. It serves as a canonical name that can be\nused for code generation, SDK method names, and internal references.\n\n## Reserved Word Restrictions\n\nCRITICAL: The name MUST NOT be a TypeScript/JavaScript reserved word, as\nit will be used as a class method name in generated code. Avoid names\nlike:\n\n- `delete`, `for`, `if`, `else`, `while`, `do`, `switch`, `case`, `break`\n- `continue`, `function`, `return`, `with`, `in`, `of`, `instanceof`\n- `typeof`, `void`, `var`, `let`, `const`, `class`, `extends`, `import`\n- `export`, `default`, `try`, `catch`, `finally`, `throw`, `new`\n- `super`, `this`, `null`, `true`, `false`, `async`, `await`\n- `yield`, `static`, `private`, `protected`, `public`, `implements`\n- `interface`, `package`, `enum`, `debugger`\n\nInstead, use alternative names for these operations:\n\n- Use `erase` instead of `delete`\n- Use `iterate` instead of `for`\n- Use `when` instead of `if`\n- Use `cls` instead of `class`\n\n## Standard Endpoint Names\n\nUse these conventional names based on the endpoint's primary function:\n\n- **`index`**: List/search operations that return multiple entities\n\n - Typically used with PATCH method for complex queries\n - Example: `PATCH /users` \u2192 `name: \"index\"`\n- **`at`**: Retrieve a specific entity by identifier\n\n - Typically used with GET method on single resource\n - Example: `GET /users/{userId}` \u2192 `name: \"at\"`\n- **`create`**: Create a new entity\n\n - Typically used with POST method\n - Example: `POST /users` \u2192 `name: \"create\"`\n- **`update`**: Update an existing entity\n\n - Typically used with PUT method\n - Example: `PUT /users/{userId}` \u2192 `name: \"update\"`\n- **`erase`**: Delete/remove an entity (NOT `delete` - reserved word!)\n\n - Typically used with DELETE method\n - Example: `DELETE /users/{userId}` \u2192 `name: \"erase\"`\n\n## Custom Endpoint Names\n\nFor specialized operations beyond basic CRUD, use descriptive verbs:\n\n- **`activate`**: Enable or turn on a feature/entity\n- **`deactivate`**: Disable or turn off a feature/entity\n- **`approve`**: Approve a request or entity\n- **`reject`**: Reject a request or entity\n- **`publish`**: Make content publicly available\n- **`archive`**: Move to archived state\n- **`restore`**: Restore from archived/deleted state\n- **`duplicate`**: Create a copy of an entity\n- **`transfer`**: Move ownership or change assignment\n- **`validate`**: Validate data or state\n- **`process`**: Execute a business process or workflow\n- **`export`**: Generate downloadable data\n- **`import`**: Process uploaded data\n\n## Naming Guidelines\n\n- MUST use camelCase naming convention\n- Use singular verb forms\n- Be concise but descriptive\n- Avoid abbreviations unless widely understood\n- Ensure the name clearly represents the endpoint's primary action\n- For nested resources, focus on the action rather than hierarchy\n- NEVER use JavaScript/TypeScript reserved words\n\nValid Examples:\n\n- `index`, `create`, `update`, `erase` (single word)\n- `updatePassword`, `cancelOrder`, `publishArticle` (camelCase)\n- `validateEmail`, `generateReport`, `exportData` (camelCase)\n\nInvalid Examples:\n\n- `update_password` (snake_case not allowed)\n- `UpdatePassword` (PascalCase not allowed)\n- `update-password` (kebab-case not allowed)\n\nPath to Name Examples:\n\n- `GET /shopping/orders/{orderId}/items` \u2192 `name: \"index\"` (lists items)\n- `POST /shopping/orders/{orderId}/cancel` \u2192 `name: \"cancel\"`\n- `PUT /users/{userId}/password` \u2192 `name: \"updatePassword\"`\n\n## Uniqueness Rule\n\nThe `name` must be unique within the API's accessor namespace. The\naccessor is formed by combining the path segments (excluding parameters)\nwith the operation name.\n\nAccessor formation:\n\n1. Extract non-parameter segments from the path (remove `{...}` parts)\n2. Join segments with dots\n3. Append the operation name\n\nExamples:\n\n- Path: `/shopping/sale/{saleId}/review/{reviewId}`, Name: `at` \u2192 Accessor:\n `shopping.sale.review.at`\n- Path: `/users/{userId}/posts`, Name: `index` \u2192 Accessor:\n `users.posts.index`\n- Path: `/auth/login`, Name: `signIn` \u2192 Accessor: `auth.login.signIn`\n\nEach accessor must be globally unique across the entire API. This ensures\noperations can be uniquely identified in generated SDKs and prevents\nnaming conflicts." }, authorizationActors: { type: "array", items: { type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", minLength: 1 }, description: "Authorization actors required to access this API operation.\n\nThis field specifies which user actors are allowed to access this\nendpoint. Multiple actors can be specified to allow different types of\nusers to access the same endpoint.\n\n## \u26A0\uFE0F CRITICAL: Actor Multiplication Effect\n\n**EACH ACTOR IN THIS ARRAY GENERATES A SEPARATE ENDPOINT**\n\n- If you specify `[\"admin\", \"moderator\", \"member\"]`, this creates 3\n separate endpoints\n- Total generated endpoints = operations \u00D7 average actors.length\n- Example: 100 operations with 3 actors each = 300 actual endpoints\n\n## \uD83D\uDD34 AVOID OVER-GENERATION\n\n**DO NOT create actor-specific endpoints when a public endpoint would\nsuffice:**\n\n- \u274C BAD: Separate GET endpoints for admin, member, moderator to view the\n same public data\n- \u2705 GOOD: Single public endpoint `[]` with actor-based filtering in\n business logic\n\n**DO NOT enumerate all possible actors when the Prisma schema uses a\nsingle User table:**\n\n- If Prisma has a User table with role/permission fields, you likely only\n need `[\"user\"]`\n- Avoid listing `[\"admin\", \"seller\", \"buyer\", \"moderator\", ...]`\n unnecessarily\n- The actual actor checking happens in business logic, not at the endpoint\n level\n\n## Naming Convention\n\nDO: Use camelCase for all actor names.\n\n## Important Guidelines\n\n- Set to empty array `[]` for public endpoints that require no\n authentication\n- Set to array with actor strings for actor-restricted endpoints\n- **MINIMIZE the number of actors per endpoint to prevent explosion**\n- Consider if the endpoint can be public with actor-based filtering instead\n- The actor names match exactly with the user type/actor defined in the\n database\n- This will be used by the Realize Agent to generate appropriate decorator\n and authorization logic in the provider functions\n- The controller will apply the corresponding authentication decorator\n based on these actors\n\n## Examples\n\n- `[]` - Public endpoint, no authentication required (PREFERRED for read\n operations)\n- `[\"user\"]` - Any authenticated user can access (PREFERRED for\n user-specific operations)\n- `[\"admin\"]` - Only admin users can access (USE SPARINGLY)\n- `[\"admin\", \"moderator\"]` - Both admin and moderator users can access\n (AVOID if possible)\n- `[\"seller\"]` - Only seller users can access (ONLY if Seller is a separate\n table)\n\n## Best Practices\n\n1. **Start with public `[]` for all read operations** unless sensitive data\n is involved\n2. **Use single actor `[\"user\"]` for authenticated operations** and handle\n permissions in business logic\n3. **Only use multiple actors when absolutely necessary** for different\n business logic paths\n4. **Remember: Fewer actors = Fewer endpoints = Better performance and\n maintainability**\n\nNote: The actual authentication/authorization implementation will be\nhandled by decorators at the controller level, and the provider function\nwill receive the authenticated user object with the appropriate type." }, path: { type: "string", pattern: "^\\/[a-zA-Z0-9\\/_{}.-]*$", description: "HTTP path of the API operation.\n\nThe URL path for accessing this API operation, using path parameters\nenclosed in curly braces (e.g., `/shoppings/customers/sales/{saleId}`).\n\nIt must be corresponded to the {@link parameters path parameters}.\n\nThe path structure should clearly indicate which database entity this\noperation is manipulating, helping to ensure all entities have\nappropriate API coverage.\n\nPath validation rules:\n\n- Must start with a forward slash (/)\n- Can contain only: letters (a-z, A-Z), numbers (0-9), forward slashes (/),\n curly braces for parameters ({paramName}), hyphens (-), and underscores\n (_)\n- Parameters must be enclosed in curly braces: {paramName}\n- Resource names should be in camelCase\n- No quotes, spaces, or invalid special characters allowed\n- No domain or role-based prefixes\n\nValid examples:\n\n- \"/users\"\n- \"/users/{userId}\"\n- \"/articles/{articleId}/comments\"\n- \"/attachmentFiles\"\n- \"/orders/{orderId}/items/{itemId}\"\n\nInvalid examples:\n\n- \"'/users'\" (contains quotes)\n- \"/user profile\" (contains space)\n- \"/users/[userId]\" (wrong bracket format)\n- \"/admin/users\" (role prefix)\n- \"/api/v1/users\" (API prefix)" }, method: { oneOf: [ { "const": "get" }, { "const": "post" }, { "const": "put" }, { "const": "delete" }, { "const": "patch" } ], description: "HTTP method of the API operation.\n\n**IMPORTANT**: Methods must be written in lowercase only (e.g., \"get\",\nnot \"GET\").\n\nNote that, if the API operation has {@link requestBody}, method must not\nbe `get`.\n\nAlso, even though the API operation has been designed to only get\ninformation, but it needs complicated request information, it must be\ndefined as `patch` method with {@link requestBody} data specification.\n\n- `get`: get information\n- `patch`: get information with complicated request data\n ({@link requestBody})\n- `post`: create new record\n- `put`: update existing record\n- `delete`: remove record" } }, required: [ "specification", "description", "summary", "parameters", "requestBody", "responseBody", "name", "authorizationActors", "path", "method" ], description: "Operation of the Restful API.\n\nThis interface defines a single API endpoint with its HTTP {@link method},\n{@link path}, {@link parameters path parameters},\n{@link requestBody request body}, and {@link responseBody} structure. It\ncorresponds to an individual operation in the paths section of an OpenAPI\ndocument.\n\nEach operation requires a detailed explanation of its purpose through the\nreason and description fields, making it clear why the API was designed and\nhow it should be used.\n\nDO: Use object types for all request bodies and responses. DO: Reference\nnamed types defined in the components section. DO: Use `application/json`\nas the content-type. DO: Use `string & tags.Format<\"uri\">` in the schema\nfor file upload/download operations instead of binary data formats.\n\nIn OpenAPI, this might represent:\n\n```json\n{\n \"/shoppings/customers/orders\": {\n \"post\": {\n \"description\": \"Create a new order application from shopping cart...\",\n \"parameters\": [...],\n \"requestBody\": {...},\n \"responses\": {...}\n }\n }\n}\n```" }, "AutoBeOpenApi.IParameter": { type: "object", properties: { name: { type: "string", pattern: "^[a-z][a-zA-Z0-9]*$", description: "Identifier name of the path parameter.\n\nThis name must match exactly with the parameter name in the route path.\nIt must be corresponded to the\n{@link AutoBeOpenApi.IOperation.path API operation path}.\n\nMUST use camelCase naming convention." }, description: { type: "string", description: "Description about the path parameter.\n\nMake short, concise and clear description about the path parameter.\n\n> MUST be written in English. Never use other languages." }, schema: { oneOf: [ { $ref: "#/components/schemas/AutoBeOpenApi.IJsonSchema.INumber" }, { $ref: "#/components/schemas/AutoBeOpenApi.IJsonSchema.IInteger" }, { $ref: "#/components/schemas/AutoBeOpenApi.IJsonSchema.IString" } ], discriminator: { propertyName: "type", mapping: { number: "#/components/schemas/AutoBeOpenApi.IJsonSchema.INumber", integer: "#/components/schemas/AutoBeOpenApi.IJsonSchema.IInteger", string: "#/components/schemas/AutoBeOpenApi.IJsonSchema.IString" } }, description: "Type schema of the path parameter.\n\nPath parameters are typically primitive types like\n{@link AutoBeOpenApi.IJsonSchema.IString strings},\n{@link AutoBeOpenApi.IJsonSchema.IInteger integers},\n{@link AutoBeOpenApi.IJsonSchema.INumber numbers}.\n\nIf you need other types, please use request body instead with object type\nencapsulation." } }, required: [ "name", "description", "schema" ], description: "Path parameter information for API routes.\n\nThis interface defines a path parameter that appears in the URL of an API\nendpoint. Path parameters are enclosed in curly braces in the\n{@link AutoBeOpenApi.IOperation.path operation path} and must be defined\nwith their types and descriptions.\n\nFor example, if API operation path is\n`/shoppings/customers/sales/{saleId}/questions/${questionId}/comments/${commentId}`,\nthe path parameters should be like below:\n\n```json\n{\n \"path\": \"/shoppings/customers/sales/{saleId}/questions/${questionId}/comments/${commentId}\",\n \"method\": \"get\",\n \"parameters\": [\n {\n \"name\": \"saleId\",\n \"in\": \"path\",\n \"schema\": { \"type\": \"string\", \"format\": \"uuid\" },\n \"description\": \"Target sale's ID\"\n },\n {\n \"name\": \"questionId\",\n \"in\": \"path\",\n \"schema\": { \"type\": \"string\", \"format\": \"uuid\" },\n \"description\": \"Target question's ID\"\n },\n {\n \"name\": \"commentId\",\n \"in\": \"path\",\n \"schema\": { \"type\": \"string\", \"format\": \"uuid\" },\n \"description\": \"Target comment's ID\"\n }\n ]\n}\n```" }, "AutoBeOpenApi.IJsonSchema.INumber": { type: "object", properties: { minimum: { type: "number", description: "Minimum value restriction." }, maximum: { type: "number", description: "Maximum value restriction." }, exclusiveMinimum: { type: "number", description: "Exclusive minimum value restriction." }, exclusiveMaximum: { type: "number", description: "Exclusive maximum value restriction." }, multipleOf: { type: "number", exclusiveMinimum: 0, description: "Multiple of value restriction." }, type: { "const": "number", description: "Discriminator value of the type.\n\nCRITICAL: This MUST be a SINGLE string value, NOT an array. The type\nfield identifies the JSON Schema type and must be exactly one of:\n\"boolean\", \"integer\", \"number\", \"string\", \"array\", \"object\", or\n\"null\".\n\n\u274C INCORRECT: type: [\"string\", \"null\"] // This is WRONG! \u2705 CORRECT:\ntype: \"string\" // For nullable string, use oneOf instead\n\nIf you need to express a nullable type (e.g., string | null), you MUST\nuse the `IOneOf` structure:\n\n```typescript\n{\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"null\" }]\n}\n```\n\nNEVER use array notation in the type field. The type field is a\ndiscriminator that accepts only a single string value." } }, required: [ "type" ], description: "Number (double) type info." }, "AutoBeOpenApi.IJsonSchema.IInteger": { type: "object", properties: { minimum: { type: "integer", description: "Minimum value restriction." }, maximum: { type: "integer", description: "Maximum value restriction." }, exclusiveMinimum: { type: "number", description: "Exclusive minimum value restriction." }, exclusiveMaximum: { type: "number", description: "Exclusive maximum value restriction." }, multipleOf: { type: "integer", exclusiveMinimum: 0, description: "Multiple of value restriction." }, type: { "const": "integer", description: "Discriminator value of the type.\n\nCRITICAL: This MUST be a SINGLE string value, NOT an array. The type\nfield identifies the JSON Schema type and must be exactly one of:\n\"boolean\", \"integer\", \"number\", \"string\", \"array\", \"object\", or\n\"null\".\n\n\u274C INCORRECT: type: [\"string\", \"null\"] // This is WRONG! \u2705 CORRECT:\ntype: \"string\" // For nullable string, use oneOf instead\n\nIf you need to express a nullable type (e.g., string | null), you MUST\nuse the `IOneOf` structure:\n\n```typescript\n{\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"null\" }]\n}\n```\n\nNEVER use array notation in the type field. The type field is a\ndiscriminator that accepts only a single string value." } }, required: [ "type" ], description: "Integer type info." }, "AutoBeOpenApi.IJsonSchema.IString": { type: "object", properties: { format: { oneOf: [ { "const": "date-time" }, { "const": "password" }, { "const": "regex" }, { "const": "uuid" }, { "const": "email" }, { "const": "hostname" }, { "const": "idn-email" }, { "const": "idn-hostname" }, { "const": "iri" }, { "const": "iri-reference" }, { "const": "ipv4" }, { "const": "ipv6" }, { "const": "uri" }, { "const": "uri-reference" }, { "const": "uri-template" }, { "const": "url" }, { "const": "date" }, { "const": "time" }, { "const": "duration" }, { "const": "json-pointer" }, { "const": "relative-json-pointer" } ], description: "Format restriction." }, pattern: { type: "string", description: "Pattern restriction." }, contentMediaType: { type: "string", description: "Content media type restriction." }, minLength: { type: "integer", minimum: 0, description: "Minimum length restriction." }, maxLength: { type: "integer", minimum: 0, description: "Maximum length restriction." }, type: { "const": "string", description: "Discriminator value of the type.\n\nCRITICAL: This MUST be a SINGLE string value, NOT an array. The type\nfield identifies the JSON Schema type and must be exactly one of:\n\"boolean\", \"integer\", \"number\", \"string\", \"array\", \"object\", or\n\"null\".\n\n\u274C INCORRECT: type: [\"string\", \"null\"] // This is WRONG! \u2705 CORRECT:\ntype: \"string\" // For nullable string, use oneOf instead\n\nIf you need to express a nullable type (e.g., string | null), you MUST\nuse the `IOneOf` structure:\n\n```typescript\n{\n \"oneOf\": [{ \"type\": \"string\" }, { \"type\": \"null\" }]\n}\n```\n\nNEVER use array notation in the type field. The type field is a\ndiscriminator that accepts only a single string value." } }, required: [ "type" ], description: "String type info." }, "AutoBeOpenApi.IRequestBody": { type: "object", properties: { description: { type: "string", description: "Description about the request body.\n\nMake short, concise and clear description about the request body.\n\n> MUST be written in English. Never use other languages." }, typeName: { type: "string", description: "Request body type name.\n\nThis specifies the