npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

swagger-to-jsonschema

v0.0.7

Published

通过Swagger工具暴露接口来转换成Jsonschema

Downloads

11

Readme

Swagger To Jsonschema

通过Swagger工具暴露接口来转换成Jsonschema

快速开始

  1. 安装

pnpm i swagger-to-jsonschema -D
  1. package.json中的scripts中增加相关执行脚本
swagger-to-jsonschema --script generate-json-schema
  1. 在项目根路径下创建swagger-to-jsonschema-config.js文件,文件相关配置请查看本项目中的swagger-to-jsonschema-config.js

属性说明

{
  jsonSchema: {
    schemaInput: {
      swaggerUrls: {
        claim: {
          url: 'http://10.199.134.149:9900/claim/v3/api-docs?group=claim',
          name: '报账单服务'
        },
        // admin: {
        //   url: 'http://10.199.134.149:9600/v3/api-docs?group=%E5%9F%BA%E7%A1%80%E6%95%B0%E6%8D%AE%E9%85%8D%E7%BD%AE',
        //   name: '公共服务'
        // },
        // image: {
        //   url: 'http://10.199.134.149:9400/image/v3/api-docs',
        //   name: '电子影像'
        // },
        oper: {
          url: 'http://10.199.134.149:9300/operating/v3/api-docs?group=OPERATING-DEFAULT',
          name: '运营服务'
        },
      }
    },
    // schema文件输出的路径
    schemaOutput: './jsonschema',
    // typescript interface输出的路径
    interfaceOutput: './interface',
    setting: {
      // 将api整理到一起,生成Yapi等工具所用,将同一实例内的api归类到一起,以用于yapi等工具不支持三级目录的情况
      isOutputApiManagementFile: false,
      // 当后端属性中的title为空时是否处理
      isTitleNullCompletionByPropKey: false,
      // 是否生成typescript中使用的interface信息
      isGenerateInterfaceByTypescript: true,
    }
  }
}