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

V4 设计 #40

Closed
fjc0k opened this issue Jul 10, 2020 · 5 comments
Closed

V4 设计 #40

fjc0k opened this issue Jul 10, 2020 · 5 comments
Labels
enhancement New feature or request

Comments

@fjc0k
Copy link
Owner

fjc0k commented Jul 10, 2020

支持生成 javascript 代码

新增配置参数,target: 'typescript' | 'javascript',javascript 时将生成的 typescript 代码编译为 .js + .d.ts。

拥抱 TypeScript 4

可利用标签元组简化生成的代码类型

支持 POST 传递 GET 参数

#34
#39

代码拆分

尝试支持 Swagger/OpenAPI 作为 server

可能需要写个 OpenAPIToYApi 的适配器。

@TIS-OMiddle
Copy link

😂代码拆分 这个支持。。提几个小意见,生成的代码根据id排个序?好像试过几次重新生成后,git diff全在标红

🤔尝试支持 Swagger/OpenAPI 作为 server 这个是不打算支持yapi那套导入swagger的逻辑了吗。最近在魔改,发现 yapi 的swagger解析插件把swagger model那些解析后用 "$ref" 和 "$$ref" 标记起来,但是都没有被利用起来。我现在策略是把这些特殊字段存了起来,生成接口代码时传进去但不生成被"$ref"引用的类型,最后再一次过 fake 一个类型引用它们来让 json-schema-to-typescript 生成它

@fjc0k
Copy link
Owner Author

fjc0k commented Aug 3, 2020

@TIS-OMiddle

生成的代码根据id排个序

这个可以有。

这个是不打算支持yapi那套导入swagger的逻辑了吗

YApi 目前对 swagger 3 好像支持不太友好,有打算重写。

@fjc0k
Copy link
Owner Author

fjc0k commented Aug 5, 2020

已在不引入破坏性更新的前提下在当前版本支持 生成 javascript 代码POST 传递 GET 参数,因此,后续将继续在目前版本进行功能优化升级。

@fjc0k fjc0k added the enhancement New feature or request label Aug 5, 2020
@fjc0k
Copy link
Owner Author

fjc0k commented Aug 24, 2020

已在3.5.0支持 生成的代码根据id排个序

@fjc0k fjc0k closed this as completed Aug 24, 2020
@fjc0k
Copy link
Owner Author

fjc0k commented Nov 25, 2020

@TIS-OMiddle 最新版已支持 Swagger。

import { defineConfig } from 'yapi-to-typescript'

export default defineConfig({
  serverUrl: 'https://petstore.swagger.io/v2/swagger.json',
  serverType: 'swagger',
  outputFilePath: 'api/index.ts',
  projects: [
    {
      token: '',
      categories: [
        {
          id: 0,
        },
      ],
    },
  ],
})

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

No branches or pull requests

2 participants