Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

一个请求的response就是一个自定义类型的array应该如何设置 #71

Open
guozefei opened this issue Sep 20, 2019 · 5 comments

Comments

@guozefei
Copy link

guozefei commented Sep 20, 2019

一个api的response就是一个array,
在model中有
// 测试题
test: {
id: { type: 'integer', description: '测试题id' },
dailyReadTitle: { type: 'string', description: '测试题所在今日阅读的标题' },
planId: { type: 'integer', description: '测试题所在计划的id' },
topicId: { type: 'integer', description: '测试题所在话题的id' },
questionCode: { type: 'string', description: '测试题选项标志符' },
status: { type: 'integer', description: '测试题状态,0未答,1已答' },
questions: {
type: 'array',
itemType: 'option',
description: '测试题的问题选项',
},
},
这个请求的response是 test的array 应该如何设置 @response和 contract

捕获

@guozefei
Copy link
Author

/**

  • @summary 未授权小程序用户接口
  • @description 未授权小程序用户获取某一阅读的测试题
  • @router get /mini/global/getDailyTest
  • @request query integer *dailyReadId 小程序阅读id
  • @response 200 getDailyTestResponse 成功
    */
    async getDailyTest() {

in contract/response/mini.js
getDailyTestResponse: {
result: { type: 'array', itemType: 'test' },
},

我希望能做到的是 getDailyTestResponse:{ type: 'array', itemType: 'test' },

@guozefei
Copy link
Author

guozefei commented Sep 20, 2019

如果response直接是一个字符串 @response 应该怎么设置?
捕获

@marsbabyjuan
Copy link

你好,你这个解决了吗?还是换了别的插件

@Lighitng
Copy link

Lighitng commented Nov 7, 2020

同遇到了这个问题,API response一个Array,发现好像没办法定义出来

@fewismuch
Copy link

你好,这个问题解决了么?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants