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

[新需求]接口的resBody的jsonSchema放到生成的文件中,业务代码里可以用来校验接口 #49

Closed
inceptiongt opened this issue Dec 7, 2020 · 7 comments
Labels
enhancement New feature or request

Comments

@inceptiongt
Copy link

业务代码中校验接口,抛出错误,方便调试及测试

@fjc0k fjc0k added the enhancement New feature or request label Dec 7, 2020
@fjc0k
Copy link
Owner

fjc0k commented Dec 7, 2020

可以作为可选配置开启,开启则生成请求数据和返回数据的 json schema。

@inceptiongt
Copy link
Author

inceptiongt commented Dec 8, 2020

项目怎样调试啊,用vscode自带的调试功能可以吗
launch.json麻烦也传一下

@fjc0k
Copy link
Owner

fjc0k commented Dec 8, 2020

这种比较深入的需求我来实现吧 😀 没有调试 我都是写完写个测试 没问题就发版

@inceptiongt
Copy link
Author

那什么时候可以完成呢

@inceptiongt
Copy link
Author

这种比较深入的需求我来实现吧 😀 没有调试 我都是写完写个测试 没问题就发版

image
试了下,launch.js如图配置后,可以在VSCode的debugging面板里调试了

@fjc0k fjc0k closed this as completed in 6efd726 Dec 8, 2020
@fjc0k
Copy link
Owner

fjc0k commented Dec 8, 2020

已支持,试试最新版,一个配置示例:

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

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

@fjc0k
Copy link
Owner

fjc0k commented Dec 8, 2020

这种比较深入的需求我来实现吧 😀 没有调试 我都是写完写个测试 没问题就发版

image
试了下,launch.js如图配置后,可以在VSCode的debugging面板里调试了

👍 可以试试

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