AutoBE
    Preparing search index...

    Document of the Restful API operations.

    This interface serves as the root document for defining Restful API operations and components. It corresponds to the top-level structure of an OpenAPI specification document, containing all API operations and reusable components.

    This simplified version focuses only on the operations and components, omitting other OpenAPI elements like info, servers, security schemes, etc. to keep the structure concise for AI-based code generation.

    IMPORTANT: When creating this document, you MUST ensure that:

    1. The API operations and component schemas directly correspond to the Prisma DB schema
    2. All entity types and their properties reference and incorporate the description comments from the related Prisma DB schema tables and columns
    3. Descriptions are detailed and organized into multiple paragraphs
    4. The API fully represents all entities and relationships defined in the Prisma schema
    5. EVERY SINGLE TABLE in the Prisma DB schema MUST have corresponding API operations for CRUD actions (Create, Read, Update, Delete) as applicable
    6. NO TABLE should be omitted from the API design - all tables require API coverage

    When defining component schemas, follow these naming conventions for consistency:

    • Main Entity Types: Use IEntityName format for main entity with detailed information (e.g., IShoppingSale)

      • These MUST directly correspond to entity tables in the Prisma schema
      • Their descriptions MUST incorporate the table description comments from the Prisma schema
      • Each property MUST reference the corresponding column description from the Prisma schema
      • Entity types should represent the full, detailed version of domain entities
    • Related Operation Types: Use IEntityName.IOperation format with these common suffixes:

      • IEntityName.ICreate: Request body for creation operations (POST)

        • Should include all required fields from the Prisma schema entity
      • IEntityName.IUpdate: Request body for update operations (PUT)

        • Should include updatable fields as defined in the Prisma schema
      • IEntityName.ISummary: Simplified response version with essential properties

      • IEntityName.IRequest: Request parameters for list operations (often with search/pagination)

      • IEntityName.IInvert: Alternative view of an entity from a different perspective

      • IPageIEntityName: Paginated results container with pagination and data properties

    These consistent naming patterns create a predictable and self-documenting API that accurately reflects the underlying Prisma schema, making it easier for developers to understand the purpose of each schema and its relationship to the database model.

    interface IDocument {
        components: IComponents;
        operations: IOperation[];
    }
    Index

    Properties

    components: IComponents

    Reusable components of the API operations.

    This contains schemas, parameters, responses, and other reusable elements referenced throughout the API operations. It corresponds to the components section in an OpenAPI document.

    CRITICAL: Components MUST include type definitions for EVERY TABLE in the Prisma schema. The AI generation process MUST create schema components for ALL database entities without exception, regardless of how many tables are in the database.

    IMPORTANT: For all component types and their properties:

    1. EVERY component MUST have a detailed description that references the corresponding Prisma DB schema table's description comments
    2. EACH property within component types MUST have detailed descriptions that reference the corresponding column description comments in the Prisma DB schema
    3. All descriptions MUST be organized into MULTIPLE PARAGRAPHS (separated by line breaks) based on different aspects of the entity
    4. Descriptions should be comprehensive enough that anyone who reads them can understand the purpose, functionality, and relationships of the type
    5. ALL TABLES from the Prisma schema MUST have corresponding schema components, no matter how many tables are in the schema

    All request and response bodies must reference named types defined in this components section. This ensures consistency and reusability across the API.

    When defining schema components, follow these standardized naming patterns for consistency and clarity:

    • IEntityName

      • Primary entity objects (e.g., IShoppingSale, IShoppingOrder)
      • These represent the full, detailed version of domain entities
    • IEntityName.ICreate

      • Request body schemas for creation operations (POST)
      • Contains all fields needed to create a new entity
    • IEntityName.IUpdate

      • Request body schemas for update operations (PUT)
      • Contains fields that can be modified on an existing entity
    • IEntityName.IRequest

      • Parameters for search/filter/pagination in list operations
      • Often contains search, sort, page, and limit properties
    • IEntityName.ISummary

      • Simplified view of entities for list operations
      • Contains essential properties only, omitting detailed nested objects
    • IEntityName.IAbridge: Intermediate view with more details than Summary but less than full entity

    • IEntityName.IInvert: Alternative representation of an entity from a different perspective

    • IPageIEntityName

      • Paginated results container
      • Usually contains pagination and data properties

    These naming conventions create a self-documenting API where the purpose of each schema is immediately clear from its name. This helps both developers and AI tools understand and maintain the API structure.

    operations: IOperation[]

    List of API operations.

    This array contains all the API endpoints with their HTTP methods, descriptions, parameters, request/response structures, etc. Each operation corresponds to an entry in the paths section of an OpenAPI document.

    CRITICAL: This array MUST include operations for EVERY TABLE defined in the Prisma schema. The AI generation MUST NOT skip or omit any tables when creating operations. The operations array MUST be complete and exhaustive, covering all database entities without exception.

    IMPORTANT: For each API operation, ensure that:

    1. EVERY independent entity table in the Prisma schema has corresponding API operations for basic CRUD functions (at minimum)
    2. ALL TABLES from the Prisma schema MUST have at least one API operation, no matter how many tables are in the schema
    3. DO NOT STOP generating API operations until ALL tables have been addressed
    4. The description field refers to and incorporates the description comments from the related DB schema tables and columns
    5. The description must be VERY detailed and organized into MULTIPLE PARAGRAPHS separated by line breaks, not just a single paragraph
    6. The description should explain the purpose, functionality, and any relationships to other entities in the database schema

    Note that, combination of AutoBeOpenApi.IOperation.path and AutoBeOpenApi.IOperation.method must be unique.

    Also, never forget any specification that is listed on the requirement analysis report and DB design documents. Every feature must be implemented in the API operations.

    1