yp-yapi
TypeScript icon, indicating that this package has built-in type declarations

1.3.1 • Public • Published

基于 ytt 封装。

修改项

导出类型

export IModels {
  'POST/test': {
    Req: {
      a: string
    }
    Res: {
      b: string
    }
  }
}

自定义路径

POST/test 路径可自定义,在配置文件中增加 getModelName,具体参考 ytt

转换返回值类型

transformRes,如下:后端返回值不统一,有的直接返回data,有的包了一层基础结构,此方法可统一结构。

transformRes(source) {
  if (source.includes('askId')) {
    return source
  }
  return `{
    code: number
    message: string
    data: ${source}
    error: boolean
    }
  `
}

Readme

Keywords

Package Sidebar

Install

npm i yp-yapi

Weekly Downloads

4

Version

1.3.1

License

MIT

Unpacked Size

171 kB

Total Files

20

Last publish

Collaborators

  • sudo_007