Closed zeffon closed 2 years ago
I found that when we share the same schema, after @body is referenced first, the subsequent @query and @path will be invalid
const idSchema = { id: { type: 'number', required: true } }; @prefix('/api/redis') export default class RedisController { @request('post', '/user1') @summary('Redis GET') @tag @body(idSchema) async getValue(ctx: Koa.Context, next: any) { const id = ctx.params.id + ''; const res = await redisGet(id); ctx.body = res; } @request('get', '/user') @summary('Redis SET') @tag @query(idSchema) async setValue(ctx: Koa.Context, next: any) { const id = ctx.request.body.id; await redisSet(id, `this user is ${id}`); global.UnifyResponse.createSuccess({}); } @request('get', '/user2') @summary('Redis GET') @tag @path(idSchema) async getValueq(ctx: Koa.Context, next: any) { const id = ctx.params.id + ''; const res = await redisGet(id); ctx.body = res; } }
In the above code, if @body is placed at the end, both @query and @path can be verified normally. In the above code, if @body is placed in the middle, @query is normal and @path is invalid
I found that the bug has been resolved in v1.8.5, thanks.
I found that when we share the same schema, after @body is referenced first, the subsequent @query and @path will be invalid
In the above code, if @body is placed at the end, both @query and @path can be verified normally. In the above code, if @body is placed in the middle, @query is normal and @path is invalid