egg-controller
egg-controller copied to clipboard
Declarative controller definition, type friendly.
1. 将 `openapi-generator`(不限于) 配置为可选依赖,需要用到的自行安装 2. `@types/request` 是否应该在 `devDependencies` 主要原因是包有依赖 yargs-parser,有一个需要处理的问题 https://www.npmjs.com/advisories/1500 ,但我看依赖又比较深,而且`openapi-generator`在该组件中并不是必选必要的功能。
在生成 open API 上 - 希望使用 [typescript-json-schema](https://github.com/YousefED/typescript-json-schema) 这样 response,requestBody 都能通过 interface 去生成 - FromQuery | FromBody 等目前只能定义别名,希望添加一个 SchemaObject 参数,去完善参数定义 如果有了 json schema, 参数验证是不是可以基于 schema 定义,再加一些自定义设置,如 `min` `maxlength` 就可以生成了呢? 我结合了 [typescript-json-schema](https://github.com/YousefED/typescript-json-schema),做了一些尝试...
## 自定义 Request 对象的名称 在 validateMetaInfo 增加 schemaName 字段,用于解决 `Request` 为 `object` 时, 名称总是 `GenType_` ```ts @route('POST /api/body', { name: 'post with body: q', validateMetaInfo: [ { name: 'q', rule:...
有相关文档详细讲解 router 注册顺序问题么? 比如不同 controller 内部的 route ,以及同一个 controller 不同方法上的 route 和 同一个方法上的 多个 route
## 问题描述 比如有一个TestController,内部有两个接口对应两个function ``` ... @route('/api/test/create', { name: '创建test', method: ['post'] }) async create() { return await this.ctx.service.test.create(); } @route('/api/test/update', { name: '更新test', method: ['post'] }) async update() { return...
对不同类型的request中的数据按照对应的参数装饰器自动注入的方法中
validateMetaInfo 是基于 https://github.com/node-modules/parameter 的实现,后续使用 paramSchema(OpenAPI)规范替代,便于读取详细类型信息