---
openapi: 3.1.0
info:
  title: Flexmodel API
  version: 0.0.1
paths:
  /api/f/apis:
    get:
      summary: 获取接口定义列表
      tags:
      - 【Flexmodel】接口定义
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiDefinitionTreeSchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      summary: 创建接口定义
      tags:
      - 【Flexmodel】接口定义
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApiDefinitionSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiDefinitionSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/apis/generate:
    post:
      summary: 根据模型生成接口定义
      tags:
      - 【Flexmodel】接口定义
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GenerateAPIsDTO"
        required: true
      responses:
        "201":
          description: Created
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/apis/{id}:
    patch:
      summary: 更新接口定义(局部更新)
      tags:
      - 【Flexmodel】接口定义
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApiDefinitionSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiDefinitionSchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    put:
      summary: 更新接口定义
      tags:
      - 【Flexmodel】接口定义
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApiDefinitionSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApiDefinitionSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    delete:
      summary: 删除接口定义
      tags:
      - 【Flexmodel】接口定义
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/auth/login:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LoginRequest"
        required: true
      responses:
        "200":
          description: OK
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
      summary: Login
      tags:
      - Auth Resource
  /api/f/auth/me:
    get:
      responses:
        "200":
          description: OK
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Get User Info
      tags:
      - Auth Resource
  /api/f/auth/refresh:
    post:
      parameters:
      - name: refreshToken
        in: cookie
        schema:
          type: string
      responses:
        "200":
          description: OK
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Refresh
      tags:
      - Auth Resource
  /api/f/chat/completions:
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ChatRequest"
        required: true
      responses:
        "200":
          description: OK
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
      summary: Chat Completions
      tags:
      - Ai Chat Resource
  /api/f/chat/conversations:
    get:
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AiChatConversation"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: List Conversations
      tags:
      - Ai Chat Resource
    post:
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateConversationRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AiChatConversation"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
      summary: Create Conversation
      tags:
      - Ai Chat Resource
  /api/f/chat/conversations/{id}:
    get:
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AiChatConversation"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Get Conversation
      tags:
      - Ai Chat Resource
    delete:
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Delete Conversation
      tags:
      - Ai Chat Resource
  /api/f/chat/conversations/{id}/messages:
    post:
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SendMessageRequest"
        required: true
      responses:
        "200":
          description: OK
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
      summary: Send Message
      tags:
      - Ai Chat Resource
    get:
      parameters:
      - name: id
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/AiChatMessage"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: List Messages
      tags:
      - Ai Chat Resource
  /api/f/codegen/templates:
    get:
      tags:
      - 【Flexmodel】生成器
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/TemplateInfo"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Get Templates
  /api/f/codegen/{datasource}_{template}.zip:
    get:
      tags:
      - 【Flexmodel】生成器
      parameters:
      - name: datasource
        in: path
        required: true
        schema:
          type: string
      - name: template
        in: path
        required: true
        schema:
          type: string
      - name: variables
        in: query
        schema:
          type: string
      responses:
        "200":
          description: OK
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
      summary: Generate
  /api/f/datasources:
    get:
      summary: 获取所有数据源
      tags:
      - 【Flexmodel】数据源
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/DatasourceSchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      summary: 创建数据源
      tags:
      - 【Flexmodel】数据源
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DatasourceSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DatasourceSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/physics/names:
    post:
      summary: 获取物理数据库表名称
      tags:
      - 【Flexmodel】数据源
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DatasourceSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  type: string
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/validate:
    post:
      summary: 验证数据源连接
      tags:
      - 【Flexmodel】数据源
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DatasourceSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  success:
                    description: 是否成功
                  errorMsg:
                    description: 错误消息
                  time:
                    description: 耗时
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}:
    put:
      summary: 更新数据源
      tags:
      - 【Flexmodel】数据源
      parameters:
      - description: 数据源名称
        in: path
        name: datasourceName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DatasourceSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DatasourceSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    delete:
      summary: 删除数据源
      tags:
      - 【Flexmodel】数据源
      parameters:
      - description: 数据源名称
        in: path
        name: datasourceName
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/datasources/{datasourceName}/import:
    post:
      summary: 导入模型到数据源
      tags:
      - 【Flexmodel】数据源
      parameters:
      - description: 数据源名称
        in: path
        name: datasourceName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ImportScriptRequest"
        required: true
      responses:
        "201":
          description: Created
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/models:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    get:
      summary: 获取模型列表
      tags:
      - 【Flexmodel】模型
      responses:
        "200":
          description: OK
          content:
            application/json:
              examples:
                实体:
                  value:
                  - type: entity
                    name: Student
                    fields:
                    - name: id
                      type: Long
                      identity: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentName
                      type: String
                      modelName: Student
                      unique: false
                      nullable: true
                      length: 255
                    - name: gender
                      type: EnumRef
                      from: UserGender
                      multiple: false
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: interest
                      type: EnumRef
                      from: user_interest
                      multiple: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: age
                      type: Int
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: classId
                      type: Long
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentDetail
                      type: Relation
                      modelName: Student
                      unique: false
                      nullable: true
                      multiple: false
                      from: StudentDetail
                      localField: id
                      foreignField: studentId
                      cascadeDelete: true
                    indexes:
                    - modelName: Student
                      name: IDX_studentName
                      fields:
                      - fieldName: studentName
                        direction: ASC
                      unique: false
                枚举:
                  value:
                  - name: UserGender
                    type: enum
                    elements:
                    - UNKNOWN
                    - MALE
                    - FEMALE
                    comment: 性别
                本地查询:
                  value:
                  - name: 分组查询
                    type: native_query
                    statement: "select count(id) as total, gender, max(age) as ageSum\
                      \ from Student group by gender"
              schema:
                anyOf:
                - $ref: "#/components/schemas/EnumSchema"
                - $ref: "#/components/schemas/NativeQuerySchema"
                - $ref: "#/components/schemas/EntitySchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      summary: 创建模型
      tags:
      - 【Flexmodel】模型
      requestBody:
        content:
          application/json:
            examples:
              实体:
                value:
                  type: entity
                  name: Student
                  fields:
                  - name: id
                    type: Long
                    identity: true
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: studentName
                    type: String
                    modelName: Student
                    unique: false
                    nullable: true
                    length: 255
                  - name: gender
                    type: EnumRef
                    from: UserGender
                    multiple: false
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: interest
                    type: EnumRef
                    from: user_interest
                    multiple: true
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: age
                    type: Int
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: classId
                    type: Long
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: studentDetail
                    type: Relation
                    modelName: Student
                    unique: false
                    nullable: true
                    multiple: false
                    from: StudentDetail
                    localField: id
                    foreignField: studentId
                    cascadeDelete: true
                  indexes:
                  - modelName: Student
                    name: IDX_studentName
                    fields:
                    - fieldName: studentName
                      direction: ASC
                    unique: false
              枚举:
                value:
                  name: UserGender
                  type: enum
                  elements:
                  - UNKNOWN
                  - MALE
                  - FEMALE
                  comment: 性别
              本地查询:
                value:
                  name: 分组查询
                  type: native_query
                  statement: "select count(id) as total, gender, max(age) as ageSum\
                    \ from Student group by gender"
            schema:
              anyOf:
              - $ref: "#/components/schemas/EnumSchema"
              - $ref: "#/components/schemas/NativeQuerySchema"
              - $ref: "#/components/schemas/EntitySchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              examples:
                实体:
                  value:
                    type: entity
                    name: Student
                    fields:
                    - name: id
                      type: Long
                      identity: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentName
                      type: String
                      modelName: Student
                      unique: false
                      nullable: true
                      length: 255
                    - name: gender
                      type: EnumRef
                      from: UserGender
                      multiple: false
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: interest
                      type: EnumRef
                      from: user_interest
                      multiple: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: age
                      type: Int
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: classId
                      type: Long
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentDetail
                      type: Relation
                      modelName: Student
                      unique: false
                      nullable: true
                      multiple: false
                      from: StudentDetail
                      localField: id
                      foreignField: studentId
                      cascadeDelete: true
                    indexes:
                    - modelName: Student
                      name: IDX_studentName
                      fields:
                      - fieldName: studentName
                        direction: ASC
                      unique: false
                枚举:
                  value:
                    name: UserGender
                    type: enum
                    elements:
                    - UNKNOWN
                    - MALE
                    - FEMALE
                    comment: 性别
                本地查询:
                  value:
                    name: 分组查询
                    type: native_query
                    statement: "select count(id) as total, gender, max(age) as ageSum\
                      \ from Student group by gender"
              schema:
                anyOf:
                - $ref: "#/components/schemas/EnumSchema"
                - $ref: "#/components/schemas/NativeQuerySchema"
                - $ref: "#/components/schemas/EntitySchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/models/idl/execute:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    post:
      tags:
      - 【Flexmodel】模型
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdlRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/SchemaObject"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
      summary: Execute Idl
  /api/f/datasources/{datasourceName}/models/{modelName}:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    put:
      summary: 更新模型
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              实体:
                value:
                  type: entity
                  name: Student
                  fields:
                  - name: id
                    type: Long
                    identity: true
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: studentName
                    type: String
                    modelName: Student
                    unique: false
                    nullable: true
                    length: 255
                  - name: gender
                    type: EnumRef
                    from: UserGender
                    multiple: false
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: interest
                    type: EnumRef
                    from: user_interest
                    multiple: true
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: age
                    type: Int
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: classId
                    type: Long
                    modelName: Student
                    unique: false
                    nullable: true
                  - name: studentDetail
                    type: Relation
                    modelName: Student
                    unique: false
                    nullable: true
                    multiple: false
                    from: StudentDetail
                    localField: id
                    foreignField: studentId
                    cascadeDelete: true
                  indexes:
                  - modelName: Student
                    name: IDX_studentName
                    fields:
                    - fieldName: studentName
                      direction: ASC
                    unique: false
              枚举:
                value:
                  name: UserGender
                  type: enum
                  elements:
                  - UNKNOWN
                  - MALE
                  - FEMALE
                  comment: 性别
              本地查询:
                value:
                  name: 分组查询
                  type: native_query
                  statement: "select count(id) as total, gender, max(age) as ageSum\
                    \ from Student group by gender"
            schema:
              anyOf:
              - $ref: "#/components/schemas/EnumSchema"
              - $ref: "#/components/schemas/NativeQuerySchema"
              - $ref: "#/components/schemas/EntitySchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              examples:
                实体:
                  value:
                    type: entity
                    name: Student
                    fields:
                    - name: id
                      type: Long
                      identity: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentName
                      type: String
                      modelName: Student
                      unique: false
                      nullable: true
                      length: 255
                    - name: gender
                      type: EnumRef
                      from: UserGender
                      multiple: false
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: interest
                      type: EnumRef
                      from: user_interest
                      multiple: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: age
                      type: Int
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: classId
                      type: Long
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentDetail
                      type: Relation
                      modelName: Student
                      unique: false
                      nullable: true
                      multiple: false
                      from: StudentDetail
                      localField: id
                      foreignField: studentId
                      cascadeDelete: true
                    indexes:
                    - modelName: Student
                      name: IDX_studentName
                      fields:
                      - fieldName: studentName
                        direction: ASC
                      unique: false
                枚举:
                  value:
                    name: UserGender
                    type: enum
                    elements:
                    - UNKNOWN
                    - MALE
                    - FEMALE
                    comment: 性别
                本地查询:
                  value:
                    name: 分组查询
                    type: native_query
                    statement: "select count(id) as total, gender, max(age) as ageSum\
                      \ from Student group by gender"
              schema:
                anyOf:
                - $ref: "#/components/schemas/EnumSchema"
                - $ref: "#/components/schemas/NativeQuerySchema"
                - $ref: "#/components/schemas/EntitySchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    get:
      summary: 获取单个模型
      tags:
      - 【Flexmodel】模型
      parameters:
      - name: modelName
        in: path
        required: true
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              examples:
                实体:
                  value:
                    type: entity
                    name: Student
                    fields:
                    - name: id
                      type: Long
                      identity: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentName
                      type: String
                      modelName: Student
                      unique: false
                      nullable: true
                      length: 255
                    - name: gender
                      type: EnumRef
                      from: UserGender
                      multiple: false
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: interest
                      type: EnumRef
                      from: user_interest
                      multiple: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: age
                      type: Int
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: classId
                      type: Long
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentDetail
                      type: Relation
                      modelName: Student
                      unique: false
                      nullable: true
                      multiple: false
                      from: StudentDetail
                      localField: id
                      foreignField: studentId
                      cascadeDelete: true
                    indexes:
                    - modelName: Student
                      name: IDX_studentName
                      fields:
                      - fieldName: studentName
                        direction: ASC
                      unique: false
                枚举:
                  value:
                    name: UserGender
                    type: enum
                    elements:
                    - UNKNOWN
                    - MALE
                    - FEMALE
                    comment: 性别
                本地查询:
                  value:
                    name: 分组查询
                    type: native_query
                    statement: "select count(id) as total, gender, max(age) as ageSum\
                      \ from Student group by gender"
              schema:
                anyOf:
                - $ref: "#/components/schemas/EnumSchema"
                - $ref: "#/components/schemas/NativeQuerySchema"
                - $ref: "#/components/schemas/EntitySchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    delete:
      summary: 删除模型
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/datasources/{datasourceName}/models/{modelName}/fields:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    post:
      summary: 创建字段
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TypedFieldSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TypedFieldSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/models/{modelName}/fields/{fieldName}:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    put:
      summary: 更新字段
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      - description: 字段名称
        in: path
        name: fieldName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/TypedFieldSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TypedFieldSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    delete:
      summary: 删除字段
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      - description: 字段名称
        in: path
        name: fieldName
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/datasources/{datasourceName}/models/{modelName}/indexes:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    post:
      summary: 创建索引
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            example:
              modelName: Student
              name: IDX_studentName
              fields:
              - fieldName: studentName
                direction: ASC
              unique: false
            schema:
              $ref: "#/components/schemas/IndexSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              example:
                modelName: Student
                name: IDX_studentName
                fields:
                - fieldName: studentName
                  direction: ASC
                unique: false
              schema:
                $ref: "#/components/schemas/IndexSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/models/{modelName}/indexes/{indexName}:
    parameters:
    - description: 数据源名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    put:
      summary: 更新索引
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      - description: 索引名称
        in: path
        name: indexName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            example:
              modelName: Student
              name: IDX_studentName
              fields:
              - fieldName: studentName
                direction: ASC
              unique: false
            schema:
              $ref: "#/components/schemas/IndexSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              example:
                modelName: Student
                name: IDX_studentName
                fields:
                - fieldName: studentName
                  direction: ASC
                unique: false
              schema:
                $ref: "#/components/schemas/IndexSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    delete:
      summary: 删除索引
      tags:
      - 【Flexmodel】模型
      parameters:
      - description: 模型名称
        in: path
        name: modelName
        required: true
        schema:
          type: string
      - description: 索引名称
        in: path
        name: indexName
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/datasources/{datasourceName}/models/{modelName}/records:
    parameters:
    - description: 模型名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    - name: modelName
      in: path
      required: true
      schema:
        type: string
    get:
      summary: 获取模型数据记录列表
      tags:
      - 【Flexmodel】记录
      parameters:
      - description: 当前页，默认值：1
        example: 1
        in: query
        name: page
        schema:
          type: integer
          format: int32
          default: 1
      - description: 第几页，默认值：15
        example: 15
        in: query
        name: size
        schema:
          type: integer
          format: int32
          default: 15
      - description: 查询条件，更多信息见查询条件文档
        example: |
          "{ \"username\": { \"_eq\": \"john_doe\" } }"
        in: query
        name: filter
        schema:
          type: string
      - description: 是否开启嵌套子查询，开启则查询关联数据，只查询5层，默认值false
        example: false
        in: query
        name: nestedQuery
        schema:
          type: boolean
          default: false
      - description: 排序
        example: |
          "[{\"field\":\"name\",\"sort\":\"ASC\"}, {\"field\":\"id\",\"sort\":\"DESC\"}]"
        in: query
        name: sort
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  total:
                    description: 总数
                  list:
                    type: array
                    items:
                      type: object
                    description: 日志列表
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      summary: 创建模型数据记录
      tags:
      - 【Flexmodel】记录
      requestBody:
        content:
          application/json:
            examples:
              请求示例，可包含关联数据，关联数据有Id字段则更新这条关联记录:
                value:
                  studentName: 张三
                  gender: MALE
                  interest:
                  - chang
                  - tiao
                  - rap
                  - daLanQiu
                  age: 10
                  classId: 1
                  studentDetail:
                    description: 张三的描述
                  courses:
                  - courseNo: Math
                    courseName: 数学
                  - courseNo: YuWen
                    courseName: 语文
                  - courseNo: Eng
                    courseName: 英语
            schema:
              type: object
              additionalProperties: {}
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/models/{modelName}/records/{id}:
    parameters:
    - description: 模型名称
      in: path
      name: datasourceName
      required: true
      schema:
        type: string
    - name: modelName
      in: path
      required: true
      schema:
        type: string
    patch:
      summary: 更新模型数据记录(局部更新)
      tags:
      - 【Flexmodel】记录
      parameters:
      - description: ID
        example: "1"
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              请求示例，可包含关联数据，关联数据有Id字段则更新这条关联记录:
                value:
                  studentName: 张三
                  gender: MALE
                  interest:
                  - chang
                  - tiao
                  - rap
                  - daLanQiu
                  age: 10
                  classId: 1
                  studentDetail:
                    description: 张三的描述
                  courses:
                  - courseNo: Math
                    courseName: 数学
                  - courseNo: YuWen
                    courseName: 语文
                  - courseNo: Eng
                    courseName: 英语
            schema:
              type: object
              additionalProperties: {}
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    put:
      summary: 更新模型数据记录
      tags:
      - 【Flexmodel】记录
      parameters:
      - description: ID
        example: "1"
        in: path
        name: id
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            examples:
              请求示例，可包含关联数据，关联数据有Id字段则更新这条关联记录:
                value:
                  id: 1
                  studentName: 张三
                  gender: MALE
                  interest:
                  - chang
                  - tiao
                  - rap
                  - daLanQiu
                  age: 10
                  classId: 1
                  studentDetail:
                    description: 张三的描述
                  courses:
                  - courseNo: Math
                    courseName: 数学
                  - courseNo: YuWen
                    courseName: 语文
                  - courseNo: Eng
                    courseName: 英语
            schema:
              type: object
              additionalProperties: {}
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    get:
      summary: 获取单条模型数据记录
      tags:
      - 【Flexmodel】记录
      parameters:
      - description: ID
        example: "1"
        in: path
        name: id
        required: true
        schema:
          type: string
      - name: nestedQuery
        in: query
        schema:
          type: boolean
          default: false
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    delete:
      summary: 删除模型数据记录
      tags:
      - 【Flexmodel】记录
      parameters:
      - description: ID
        example: "1"
        in: path
        name: id
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/datasources/{datasourceName}/native-query:
    post:
      summary: 执行原生查询
      tags:
      - 【Flexmodel】数据源
      parameters:
      - description: 数据源名称
        in: path
        name: datasourceName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ExecuteNativeQueryRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  time:
                    description: 执行耗时
                  result:
                    description: 返回结果
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/datasources/{datasourceName}/sync:
    post:
      summary: 从数据源同步物理表到建模
      tags:
      - 【Flexmodel】数据源
      parameters:
      - description: 数据源名称
        in: path
        name: datasourceName
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: array
              uniqueItems: true
              items:
                type: string
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              examples:
                实体:
                  value:
                  - type: entity
                    name: Student
                    fields:
                    - name: id
                      type: Long
                      identity: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentName
                      type: String
                      modelName: Student
                      unique: false
                      nullable: true
                      length: 255
                    - name: gender
                      type: EnumRef
                      from: UserGender
                      multiple: false
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: interest
                      type: EnumRef
                      from: user_interest
                      multiple: true
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: age
                      type: Int
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: classId
                      type: Long
                      modelName: Student
                      unique: false
                      nullable: true
                    - name: studentDetail
                      type: Relation
                      modelName: Student
                      unique: false
                      nullable: true
                      multiple: false
                      from: StudentDetail
                      localField: id
                      foreignField: studentId
                      cascadeDelete: true
                    indexes:
                    - modelName: Student
                      name: IDX_studentName
                      fields:
                      - fieldName: studentName
                        direction: ASC
                      unique: false
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/EntitySchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/docs/openapi.json:
    get:
      summary: 获取接口文档
      tags:
      - 【Flexmodel】接口文档
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/global/profile:
    get:
      summary: 获取系统配置
      tags:
      - 【Flexmodel】系统
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  env:
                    description: 环境变量
                  properties:
                    description: 配置属性
                  application:
                    description: 应用程序配置
                  settings:
                    description: 系统设置
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/graphql:
    post:
      summary: 执行GraphQL查询
      tags:
      - 【Flexmodel】GraphQL
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/GraphQLRequest"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ExecutionResult"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/identity-providers:
    get:
      summary: 获取身份源列表
      tags:
      - 【Flexmodel】身份源
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/IdentityProviderSchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    post:
      summary: 创建身份源
      tags:
      - 【Flexmodel】身份源
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdentityProviderSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdentityProviderSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
  /api/f/identity-providers/{name}:
    put:
      summary: 更新身份源
      tags:
      - 【Flexmodel】身份源
      parameters:
      - description: 名称
        in: path
        name: name
        required: true
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/IdentityProviderSchema"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/IdentityProviderSchema"
        "400":
          $ref: "#/components/responses/BadRequest"
        "500":
          $ref: "#/components/responses/InternalError"
    delete:
      summary: 删除身份源
      tags:
      - 【Flexmodel】身份源
      parameters:
      - description: 名称
        in: path
        name: name
        required: true
        schema:
          type: string
      responses:
        "204":
          description: No Content
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/logs:
    get:
      summary: 获取接口日志列表
      tags:
      - 【Flexmodel】接口日志
      parameters:
      - description: 当前页，默认值：1
        example: "1"
        in: query
        name: current
      - description: 第几页，默认值：15
        example: "15"
        in: query
        name: pageSize
      - description: 关键字
        in: query
        name: keyword
        schema:
          type: string
      - description: 日期范围
        example: "2025-01-01 00:00:00,2025-12-31 23:59:59"
        in: query
        name: dateRange
        schema:
          type: string
      - description: 日志等级
        example: INFO
        in: query
        name: level
      - name: isSuccess
        in: query
        schema:
          type: boolean
      - name: page
        in: query
        schema:
          type: integer
          format: int32
          default: 1
      - name: size
        in: query
        schema:
          type: integer
          format: int32
          default: 50
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  total:
                    description: 总数
                  list:
                    type: array
                    items:
                      type: object
                      description: 接口日志
                      properties:
                        id:
                          type: string
                          description: ID
                        uri:
                          description: 请求标识
                        level:
                          description: 等级
                        createdAt:
                          $ref: "#/components/schemas/LocalDateTime"
                          type: string
                          readOnly: true
                          description: 创建日期
                        data:
                          description: 数据
                        url:
                          type: string
                        httpMethod:
                          type: string
                        path:
                          type: string
                        requestBody: {}
                        requestHeaders: {}
                        statusCode:
                          type: integer
                          format: int32
                        responseTime:
                          type: integer
                          format: int32
                        clientIp:
                          type: string
                        isSuccess:
                          type: boolean
                        errorMessage: {}
                    description: 日志列表
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/logs/stat:
    get:
      summary: 统计接口日志
      tags:
      - 【Flexmodel】接口日志
      parameters:
      - description: 关键字
        in: query
        name: keyword
        schema:
          type: string
      - description: 日期范围
        example: "2022-01-01 00:00:00,2022-01-01 23:59:59"
        in: query
        name: dateRange
        schema:
          type: string
      - description: "日志等级，支持传多个通过“,”分隔"
        example: INFO
        in: query
        name: level
      - name: isSuccess
        in: query
        schema:
          type: boolean
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: "#/components/schemas/ApiLogStatSchema"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/overview:
    get:
      summary: 获取概述
      tags:
      - 【Flexmodel】概述
      parameters:
      - description: 日期范围
        example: "2025-01-01 00:00:00,2025-12-31 23:59:59"
        in: query
        name: dateRange
        schema:
          type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                properties:
                  queryCount:
                    description: 查询接口定义统计
                  mutationCount:
                    description: 变更接口定义统计
                  subscribeCount:
                    description: 订阅接口定义统计
                  dataSourceCount:
                    description: 数据源统计
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
  /api/f/settings:
    patch:
      summary: 保存设置
      tags:
      - 【Flexmodel】设置
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/Settings"
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Settings"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
    get:
      summary: 获取设置
      tags:
      - 【Flexmodel】设置
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Settings"
        "500":
          $ref: "#/components/responses/InternalError"
        "400":
          $ref: "#/components/responses/BadRequest"
components:
  responses:
    InternalError:
      description: Internal Error
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                example: -1
              message:
                type: string
                example: 失败
              success:
                type: boolean
                example: false
          examples:
            fail:
              value:
                code: -1
                message: 失败
                success: false
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            type: object
            properties:
              code:
                type: integer
                example: 400
              message:
                type: string
                example: 参数验证异常
              success:
                type: boolean
                example: false
              errors:
                type: array
                items:
                  type: object
          examples:
            参数验证异常:
              value:
                code: 1001
                message: 参数验证异常
                success: false
                errors:
                - field: name
                  message: 不能为空
  schemas:
    AiChatConversation:
      type: object
      properties:
        id:
          type: string
        title:
          type: string
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
        messages:
          type: array
          items:
            $ref: "#/components/schemas/AiChatMessage"
    AiChatMessage:
      type: object
      properties:
        id:
          type: string
        conversationId:
          type: string
        role:
          type: string
        content:
          type: string
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
    ApiDefinitionSchema:
      type: object
      properties:
        id:
          type: string
          examples:
          - -1
          description: 唯一标识
        type:
          $ref: "#/components/schemas/ApiType"
          type: string
          description: "类型, FOLDER: 文件夹；API: 接口"
        path:
          type: string
          description: 路径
        meta:
          description: 元数据，存放接口定义，例如graphql定义
        name:
          type: string
          description: 名称
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 创建时间
        updatedAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 更新时间
        parentId:
          type: string
          description: 上级ID
        enabled:
          type: boolean
          description: 是否开启
          default: true
        method:
          type: string
          examples:
          - GET
          description: HTTP请求方法
    ApiDefinitionTreeDTO:
      type: object
      properties:
        id:
          type: string
        name:
          type: string
        parentId:
          type: string
        type:
          $ref: "#/components/schemas/ApiType"
        method:
          type: string
        path:
          type: string
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
        updatedAt:
          $ref: "#/components/schemas/LocalDateTime"
        meta: {}
        enabled:
          type: boolean
        children:
          type: array
          items:
            $ref: "#/components/schemas/ApiDefinitionTreeDTO"
    ApiDefinitionTreeSchema:
      type: object
      properties:
        id:
          type: string
          examples:
          - -1
          description: 唯一标识
        type:
          $ref: "#/components/schemas/ApiType"
          type: string
          description: "类型, FOLDER: 文件夹；API: 接口"
        path:
          type: string
          description: 路径
        meta:
          description: 元数据，存放接口定义，例如graphql定义
        name:
          type: string
          description: 名称
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 创建时间
        updatedAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 更新时间
        parentId:
          type: string
          description: 上级ID
        enabled:
          type: boolean
          description: 是否开启
          default: true
        method:
          type: string
          examples:
          - GET
          description: HTTP请求方法
        children:
          type: array
          items:
            $ref: "#/components/schemas/ApiDefinitionTreeDTO"
          description: 子节点
    ApiLogSchema:
      type: object
      description: 接口日志
      properties:
        id:
          type: string
          description: ID
        uri:
          description: 请求标识
        level:
          description: 等级
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 创建日期
        data:
          description: 数据
        url:
          type: string
        httpMethod:
          type: string
        path:
          type: string
        requestBody: {}
        requestHeaders: {}
        statusCode:
          type: integer
          format: int32
        responseTime:
          type: integer
          format: int32
        clientIp:
          type: string
        isSuccess:
          type: boolean
        errorMessage: {}
    ApiLogStatSchema:
      type: object
      description: 日志统计
      properties:
        date:
          type: string
          description: 日期
        total:
          type: integer
          format: int64
          description: 总数
    ApiType:
      type: string
      enum:
      - FOLDER
      - API
    ChatMessage:
      type: object
      properties:
        role:
          type: string
        content:
          type: string
    ChatRequest:
      type: object
      properties:
        conversationId:
          type: string
        model:
          type: string
        messages:
          type: array
          items:
            $ref: "#/components/schemas/ChatMessage"
        temperature:
          type: number
          format: double
        maxTokens:
          type: integer
          format: int32
    CreateConversationRequest:
      type: object
      properties:
        title:
          type: string
    DatasourceSchema:
      type: object
      description: 接口日志
      properties:
        name:
          type: string
          description: 名称，需要唯一
        type:
          $ref: "#/components/schemas/DatasourceType"
          type: string
          description: 数据源类型
        config:
          type: object
          description: 数据源配置
        enabled:
          type: boolean
          description: 是否启用
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 创建日期
        updatedAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 更新日期
    DatasourceType:
      type: string
      enum:
      - SYSTEM
      - USER
    DefaultValue:
      type: object
      properties:
        type:
          type: string
        value: {}
        name:
          type: string
        fixed:
          type: boolean
        generated:
          type: boolean
    Direction:
      type: string
      enum:
      - ASC
      - DESC
    EntitySchema:
      type: object
      description: 实体
      properties:
        name:
          type: string
          description: 名称
        type:
          type: string
          description: "类型, entity: 实体；native_query: 本地查询；enum: 枚举"
        fields:
          type: array
          items:
            type: object
            properties:
              name:
                type: string
              type:
                type: string
              modelName:
                type: string
              comment:
                type: string
              unique:
                type: boolean
              nullable:
                type: boolean
              defaultValue:
                $ref: "#/components/schemas/DefaultValue"
              additionalProperties:
                type: object
                additionalProperties: {}
              identity:
                type: boolean
              concreteType:
                type: string
          description: 字段列表
        indexes:
          type: array
          items:
            $ref: "#/components/schemas/IndexDefinition"
          description: 索引列表
        comment:
          type: string
          description: 注释
        additionalProperties:
          type: object
          additionalProperties: {}
          description: 用户自定义扩展属性
        idl:
          type: string
    EnumSchema:
      type: object
      description: 枚举
      properties:
        name:
          type: string
          description: 名称
        comment:
          type: string
          description: 注释
        elements:
          type: array
          items:
            type: string
          description: 元素列表
        additionalProperties:
          type: object
          additionalProperties: {}
          description: 用户自定义扩展属性
        idl:
          type: string
        type:
          type: string
    ErrorClassification:
      type: object
    ExecuteNativeQueryRequest:
      type: object
      properties:
        statement:
          type: string
          description: 语句
        parameters:
          type: object
          additionalProperties: {}
          description: 参数
    ExecutionResult:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: "#/components/schemas/GraphQLError"
        data: {}
        dataPresent:
          type: boolean
        extensions:
          type: object
          additionalProperties: {}
    Field:
      type: object
      properties:
        fieldName:
          type: string
        direction:
          $ref: "#/components/schemas/Direction"
    GenerateAPIsDTO:
      type: object
      required:
      - datasourceName
      - modelName
      - apiFolder
      - idFieldOfPath
      - generateAPIs
      properties:
        datasourceName:
          type: string
          pattern: \S
        modelName:
          type: string
          pattern: \S
        apiFolder:
          type: string
          pattern: \S
        idFieldOfPath:
          type: string
          pattern: \S
        generateAPIs:
          type: array
          minItems: 1
          items:
            type: string
    GraphQLError:
      type: object
      properties:
        message:
          type: string
        locations:
          type: array
          items:
            $ref: "#/components/schemas/SourceLocation"
        errorType:
          $ref: "#/components/schemas/ErrorClassification"
        path:
          type: array
          items: {}
        extensions:
          type: object
          additionalProperties: {}
    GraphQLRequest:
      type: object
      properties:
        operationName:
          type: string
          description: 操作名称
        query:
          type: string
          description: 查询
        variables:
          type: object
          additionalProperties: {}
          description: 变量
    IdentityProviderSchema:
      type: object
      description: 身份源
      properties:
        name:
          type: string
          description: 名称，需要唯一
        provider:
          type: object
          description: 身份源配置
        createdAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 创建日期
        updatedAt:
          $ref: "#/components/schemas/LocalDateTime"
          type: string
          readOnly: true
          description: 更新日期
    IdlRequest:
      type: object
      properties:
        idl:
          type: string
    ImportScriptRequest:
      type: object
      required:
      - script
      properties:
        script:
          type: string
          pattern: \S
          description: 脚本
        type:
          $ref: "#/components/schemas/ImportScriptType"
          type: string
          description: 脚本类型
    ImportScriptType:
      type: string
      enum:
      - JSON
      - IDL
    IndexDefinition:
      type: object
      properties:
        name:
          type: string
        modelName:
          type: string
        fields:
          type: array
          items:
            $ref: "#/components/schemas/Field"
        unique:
          type: boolean
    IndexSchema:
      type: object
      description: 索引，更多信息见Schema定义文档
      properties:
        name:
          type: string
          description: 名称
        fields:
          type: array
          items:
            $ref: "#/components/schemas/Field"
          description: 字段列表
        unique:
          type: boolean
          description: 是否唯一
        modelName:
          type: string
    LocalDateTime:
      type: string
      format: date-time
      examples:
      - 2022-03-10T12:15:50
    Log:
      type: object
      properties:
        maxDays:
          type: integer
          format: int32
        consoleLoggingEnabled:
          type: boolean
    LoginRequest:
      type: object
      properties:
        username:
          type: string
        password:
          type: string
    NativeQuerySchema:
      type: object
      description: 本地查询
      properties:
        name:
          type: string
          description: 名称
        type:
          type: string
          description: "类型, entity: 实体；native_query: 本地查询；enum: 枚举"
        statement:
          type: string
          description: 语句
        comment:
          description: 注释
        additionalProperties:
          type: object
          additionalProperties: {}
          description: 用户自定义扩展属性
        idl:
          type: string
        parameters:
          type: array
          uniqueItems: true
          items:
            type: string
        fields:
          type: array
          items:
            $ref: "#/components/schemas/QueryField"
    Proxy:
      type: object
      properties:
        routesEnabled:
          type: boolean
        routes:
          type: array
          items:
            $ref: "#/components/schemas/Route"
    QueryField:
      type: object
      properties:
        name:
          type: string
        aliasName:
          type: string
        fieldName:
          type: string
    Route:
      type: object
      properties:
        path:
          type: string
        to:
          type: string
    SchemaObject:
      type: object
      properties:
        name:
          type: string
        type:
          type: string
        idl:
          type: string
    Security:
      type: object
      properties:
        rateLimitingEnabled:
          type: boolean
        maxRequestCount:
          type: integer
          format: int32
        intervalInSeconds:
          type: integer
          format: int32
        graphqlEndpointPath:
          type: string
        graphqlEndpointIdentityProvider:
          type: string
    SendMessageRequest:
      type: object
      properties:
        content:
          type: string
        model:
          type: string
    Settings:
      type: object
      properties:
        appName:
          type: string
        log:
          $ref: "#/components/schemas/Log"
        security:
          $ref: "#/components/schemas/Security"
        proxy:
          $ref: "#/components/schemas/Proxy"
    SourceLocation:
      type: object
      properties:
        line:
          type: integer
          format: int32
        column:
          type: integer
          format: int32
        sourceName:
          type: string
    TemplateInfo:
      type: object
      properties:
        name:
          type: string
        variables:
          type: object
          additionalProperties: {}
    TypedFieldSchema:
      type: object
      description: 类型字段，更多信息见Schema定义文档
      properties:
        name:
          type: string
          description: 名称
        type:
          type: string
          description: 类型
        comment:
          type: string
          description: 注释
        unique:
          type: boolean
          description: 是否唯一
        nullable:
          type: boolean
          description: 可为空
        defaultValue:
          $ref: "#/components/schemas/DefaultValue"
          type: object
          description: 默认值
        additionalProperties:
          type: object
          additionalProperties: {}
          description: 用户自定义扩展属性
        modelName:
          type: string
        identity:
          type: boolean
        concreteType:
          type: string
tags:
- name: 【Flexmodel】GraphQL
  description: GraphQL接口信息
- name: 【Flexmodel】接口定义
  description: 接口定义管理
- name: 【Flexmodel】接口文档
  description: 接口文档管理
- name: 【Flexmodel】接口日志
  description: 接口日志管理
- name: 【Flexmodel】数据源
  description: 数据源管理
- name: 【Flexmodel】概述
  description: 首页概览
- name: 【Flexmodel】模型
  description: 模型管理
- name: 【Flexmodel】生成器
  description: 生成器管理
- name: 【Flexmodel】系统
  description: 系统信息
- name: 【Flexmodel】记录
  description: 模型数据记录管理
- name: 【Flexmodel】设置
  description: 系统设置
- name: 【Flexmodel】身份源
  description: 身份源管理
