前端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
相关推荐
請你喝杯Java35 分钟前
Mac软件清单(前后端开发环境搭建)
前端·后端·macos·软件
杨荧1 小时前
【开源免费】基于Vue和SpringBoot的渔具租赁系统(附论文)
前端·javascript·jvm·vue.js·spring boot·spring cloud·开源
用户3623786912591 小时前
【面试题】说说你对发布订阅、观察者模式的理解?区别?_消息订阅与发布面试题
前端
想退休的搬砖人1 小时前
前端水印功能(svg,canvas文字水印,canvas图片水印)
开发语言·前端
王同学JavaNotes1 小时前
ES6 语法:强大特性全解析
前端·es6
GISer_Jing2 小时前
前端面试题目 (Node.JS-Express框架)[二]
前端·面试·node.js·express
别发呆了吧2 小时前
前端面试准备问题2
前端·经验分享
堂铭2 小时前
NextJS多语言
前端·i18n·nextjs
憶巷2 小时前
Vue 的响应式原理
前端·javascript·vue.js
爱上语文3 小时前
HTML综合案例
前端·css·html