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

feat:增加swag的依赖和用户接口显示 #345

Merged
merged 23 commits into from
May 20, 2024
Merged

Conversation

nangongchengfeng
Copy link
Contributor

@nangongchengfeng nangongchengfeng commented May 17, 2024

在提出此拉取请求时,我确认了以下几点(请复选框):

  • 我已阅读并理解贡献者指南
  • 我已检查没有与此请求重复的拉取请求。
  • 我已经考虑过,并确认这份呈件对其他人很有价值。
  • 我接受此提交可能不会被使用,并根据维护人员的意愿关闭拉取请求。

填写 PR 内容:

  • 增加swag的依赖和用户接口显示

我目前写完用户管理的swag接口,后续会更新其余接口

image
image
image

@nangongchengfeng
Copy link
Contributor Author

github.com/swaggo/files v1.0.1
github.com/swaggo/gin-swagger v1.6.0
github.com/swaggo/swag v1.16.2

mod 需要添加这三项,我的Go依赖有些版本比线上的高。看是否合并进去?
如果不合并依赖,我就删除掉

@eryajf
Copy link
Member

eryajf commented May 17, 2024

可以新增依赖,但原有的包,非必要尽量不升级吧,很难进行全面的测试验证

@nangongchengfeng
Copy link
Contributor Author

nangongchengfeng commented May 18, 2024

可以新增依赖,但原有的包,非必要尽量不升级吧,很难进行全面的测试验证

我整个人都麻了,go mod tidy一直强行将指定好旧版本的依赖更新到最新版。
在 go.mod 文件中使用 replace 指令指定版本(测试没生效)
我采用强行阻止信版本的引入,go mod没有办法,这才老实了
通过文件对比。go mod tidy 会强制更新如下文件。已经排除。和你这边的版本保持一致

exclude (
	github.com/gin-gonic/gin v1.9.0
	github.com/go-playground/locales v0.14.1
	github.com/go-playground/universal-translator v0.18.1
	github.com/go-playground/validator/v10 v10.11.2
	github.com/pelletier/go-toml/v2 v2.0.6
	github.com/ugorji/go/codec v1.2.9
	golang.org/x/crypto v0.14.0
	golang.org/x/sys v0.13.0
	golang.org/x/text v0.13.0
	google.golang.org/protobuf v1.28.1
)

image

@nangongchengfeng
Copy link
Contributor Author

@eryajf
您好,目前已经写完所有接口的Swag的自动生成api接口注释

  • 完善所有接口注解
  • 增加安全验证注解
  • 用户登录的明细

相关接口测试没问题,有时间麻烦合并一下。README需更新一下。

使用方法:初始化

swag  init

或者直接启动,我已经把生产的文件上传,可以直接访问如下接口使用

http://127.0.0.1:8888/swagger/index.html

image
image

image
image

@eryajf
Copy link
Member

eryajf commented May 20, 2024

辛苦,晚些时候我来验证一下

@eryajf eryajf added the feature 功能 | feature label May 20, 2024
@eryajf eryajf merged commit a114b67 into opsre:main May 20, 2024
3 checks passed
@nangongchengfeng
Copy link
Contributor Author

@eryajf 大佬 交换个友链,您这边的链接已经添加

- name: 南宫乘风
  desc: 💻运维开发📝Devops技术🔗自动化
  avatar: https://ownit.top/img/avatar_hu227367ba8544f2fc7811ed9508937bec_102665_300x0_resize_box_3.png
  link: https://ownit.top/

image

@eryajf
Copy link
Member

eryajf commented Jul 23, 2024

我晚些时候更新上来

@nangongchengfeng
Copy link
Contributor Author

我晚些时候更新上来

感谢大佬。我一直以为你是开发,看了你博客才知道,你竟然是运维开发,太厉害了。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 功能 | feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants