前端OpenAPI根据后端Swagger自动生成前端接口报错

测试之后发现是因为Map<Long,List<CommentVO>>的返回值类型的锅,改成Page<List<CommentVO>>即可解决。

前端使用的umiMAX的openapi,报错如下:

      '            originalRef: BaseResponse<<boolean>>\n' +
      '        "401":\n' +
      '          description: Unauthorized\n' +
      '        "403":\n' +
      '          description: Forbidden\n' +
      '        "404":\n' +
      '          description: Not Found\n' +
      '      deprecated: false\n' +
      '      x-order: "2147483647"\n' +
      '  "/api/admin/passage/reject/{passageId}":\n' +
      '    get:\n' +
      '      tags:\n' +
      '        - admin-passage-controller\n' +
      '      summary: rejectPassage\n' +
      '      operationId: rejectPassageUsingGET\n' +
      '      produces:\n' +
      '        - "*/*"\n' +
      '      parameters:\n' +
      '        - name: passageId\n' +
      '          in: path\n' +
      '          description: passageId\n' +
      '    '... 78804 more characters,
    externals: [],
    externalRefs: {},
    rewriteRefs: true,
    preserveMiro: true,
    promise: { resolve: [Function (anonymous)], reject: [Function (anonymous)] },
    patches: 0,
    cache: {},
    openapi: {
      openapi: '3.0.0',
      info: {
        description: '无问青秋博客',
        version: 'v1.0',
        title: 'Serein博客API接口测试',
        contact: {}
      },
      tags: [
        { name: 'admin-category-controller', 'x-order': '2147483647' },
        { name: 'admin-comment-controller', 'x-order': '2147483647' },
        { name: 'admin-passage-controller', 'x-order': '2147483647' },
        { name: 'admin-tag-controller', 'x-order': '2147483647' },
        { name: 'admin-user-controller', 'x-order': '2147483647' },
        { name: 'category-controller', 'x-order': '2147483647' },
        { name: 'comment-controller', 'x-order': '2147483647' },
        { name: 'passage-controller', 'x-order': '2147483647' },
        { name: 'tag-controller', 'x-order': '2147483647' },
        { name: 'user-controller', 'x-order': '2147483647' }
      ],
      paths: {
        '/api/admin/category/addCategory': {
          post: {
            tags: [Array],
            summary: 'addCategory',
            operationId: 'addCategoryUsingPOST',
            requestBody: [Object],
            responses: [Object],
            responsesObject: [Object],
            deprecated: false,
            'x-order': '2147483647'
          }
        },
前端openapi生成接口报错

 preserveMiro: true,
    promise: { resolve: [Function (anonymous)], reject: [Function (anonymous)] },
    patches: 0,
    cache: {},
    openapi: {
      openapi: '3.0.0',
      info: {
        description: '无问青秋博客',
        version: 'v1.0',
        title: 'Serein博客API接口测试',
        contact: {}
      },
      tags: [
        { name: 'admin-category-controller', 'x-order': '2147483647' },
        { name: 'admin-comment-controller', 'x-order': '2147483647' },
        { name: 'admin-passage-controller', 'x-order': '2147483647' },
        { name: 'admin-tag-controller', 'x-order': '2147483647' },
        { name: 'admin-user-controller', 'x-order': '2147483647' },
        { name: 'category-controller', 'x-order': '2147483647' },
        { name: 'comment-controller', 'x-order': '2147483647' },
        { name: 'passage-controller', 'x-order': '2147483647' },
        { name: 'tag-controller', 'x-order': '2147483647' },
        { name: 'user-controller', 'x-order': '2147483647' }
      ],
      paths: {
        '/api/admin/category/addCategory': {
          post: {
            tags: [Array],
            summary: 'addCategory',
            operationId: 'addCategoryUsingPOST',
            requestBody: [Object],
            responses: [Object],
            responsesObject: [Object],
            deprecated: false,
            'x-order': '2147483647'
          }
        },
        '/api/admin/category/delete/{categoryId}': {
          put: {
            tags: [Array],
            summary: 'deleteCategory',
            operationId: 'deleteCategoryUsingPUT',
            parameters: [Array],
            responses: [Object],
            responsesObject: [Object],
            deprecated: false,
            'x-order': '2147483647'
          }
        },
        '/api/admin/comment/getComments/': {
          post: {
            tags: [Array],
            summary: 'getComments',
            operationId: 'getCommentsUsingPOST',
            requestBody: [Object],
            responses: [Object],
            responsesObject: [Object],
            deprecated: false,
            'x-order': '2147483647'
          }
        },       
        '/api/user/userInfoData': {
          get: {
            tags: [Array],
            summary: 'getUserInfoData',
            operationId: 'getUserInfoDataUsingGET',
            responses: [Object],
            responsesObject: [Object],
            deprecated: false,
            'x-order': '2147483647'
          }
        }
      },
      'x-openapi': {
        'x-markdownFiles': null,
        'x-setting': {
          language: 'zh-CN',
          enableSwaggerModels: true,
          swaggerModelName: 'Swagger Models',
          enableReloadCacheParameter: false,
          enableAfterScript: true,
          enableDocumentManage: true,
          enableVersion: false,
          enableRequestCache: true,
          enableFilterMultipartApis: false,
          enableFilterMultipartApiMethodType: 'POST',
          enableHost: false,
          enableHostText: '',
          enableDynamicParameter: false,
          enableDebug: true,
          enableFooter: true,
          enableFooterCustom: false,
          enableSearch: true,
          enableOpenApi: true,
          enableHomeCustom: false,
          enableGroup: true,
          enableResponseCode: true
        }
      },
      servers: [ { url: '//127.0.0.1:8081/api' } ],
      components: {
        requestBodies: {
          QueryPageRequest: {
            content: [Object],
            description: 'queryPageRequest',
            required: true
          },
          uploadPassageCoverUsingPOST: { content: [Object], required: true }
        },
        schemas: {
          AddPassageDTO: {
            type: 'object',
            properties: [Object],
            title: 'AddPassageDTO'
          },
   
          GetUserByIdListRequest: {
            type: 'object',
            properties: [Object],
            title: 'GetUserByIdListRequest'
          },
          LoginRequest: {
            type: 'object',
            properties: [Object],
            title: 'LoginRequest'
          },
          LoginUserVO: {
            type: 'object',
            properties: [Object],
            title: 'LoginUserVO'
          },
        
         
          Page_List_UserVO_: {
            type: 'object',
            properties: [Object],
            title: 'Page<<List<<UserVO>>>>'
          }
        }
      }
    },
    fetch: <ref *1> [Function: fetch] {
      isRedirect: [Function (anonymous)],
      Promise: [Function: Promise],
      default: [Circular *1],
      Headers: [class Headers],
      Request: [class Request],
      Response: [class Response],
      FetchError: [Function: FetchError]
    },
    resolver: { depth: 0, base: undefined, actions: [ [] ] },
    refmap: {}
  }
}

Node.js v20.10.0
相关推荐
m0_7482449613 分钟前
使用Nginx正向代理让内网主机通过外网主机访问互联网
java·前端·nginx
几何心凉43 分钟前
ToDesk云电脑、顺网云、网易云、易腾云、极云普惠云横测对比:探寻电竞最佳拍档
前端
老K(郭云开)2 小时前
最新版Edge浏览器加载ActiveX控件技术——allWebPlugin中间件之awp_CreateActiveXObject接口用法
前端·javascript·chrome·中间件·edge
一点一木2 小时前
从零开始:使用 Brain.js 创建你的第一个神经网络(一)
前端·javascript·人工智能
小璇玑学前端2 小时前
微信小程序地图,定位,仿多多自提点
前端
我的div丢了肿么办2 小时前
vue3.5的更新保证你看的明明白白
前端·javascript·vue.js
愚z2 小时前
WorkboxWebpackPlugin 使用指南
前端
m0_748248653 小时前
详细介绍Sd-WebUI提示词的语法规则
前端
南北极之间3 小时前
前端新手必看:10 大 UI 组件库全面解析,快速搭建高质量 Web 应用」 「从零开始:Vue 和 React 最受欢迎的 UI 组件库入门指南」 「超实用!PC 端和移动端 UI 组件库推荐与实战
前端·vue.js·ui·elementui·element·anti-design-vue·ui组件库
半点寒12W3 小时前
CSS3 2D 转换介绍
前端·css·css3