How to filter generated Swagger JSON (yaml)

后端 未结 2 1922
醉酒成梦
醉酒成梦 2021-01-25 04:10

I have over 5k lines long swagger.json file describing hundreds of paths and objects. I want to generate a TypeScript client (using swagger-codegen) using only a part of the end

2条回答
  •  春和景丽
    2021-01-25 04:43

    Finally, we created swagger-json-filter – a command-line tool allowing filtering a Swagger documentation. It can be easily used along other commands in bash:

    cat input.json | swagger-json-filter --include-paths="^\/api\/.*" > output.json
    

    The tool is performing a logic needed to filter out undesired definitions (nested also) from the output.

提交回复
热议问题