Swagger CodeGen多个API端点

问题描述 投票:0回答:1

所以在使用Swagger-CodeGen之后,我想知道是否有任何方法可以排除生成客户端文件夹(包括Configuration,ApiClient,ApiException等),因为这段代码似乎是样板文件,当我有多个端点时它会重复使用CodeGen生成。

除了手动删除客户端文件夹并在生成的Api中重新映射命名空间之外,目前有解决方案吗?

swagger-codegen
1个回答
0
投票

您可以使用.swagger-codegen-ignore文件跳过文件生成,该文件与.gitignore非常相似。这是一个例子:

# Swagger Codegen Ignore
# Lines beginning with a # are comments

# This should match build.sh located anywhere.
build.sh

# Matches build.sh in the root
/build.sh

# Exclude all recursively
docs/**

参考:https://github.com/swagger-api/swagger-codegen#ignore-file-format

© www.soinside.com 2019 - 2024. All rights reserved.