idea 快速生成接口文档

idea 快速生成接口文档

之前使用过小幺鸡,swagger 感觉不太合适自己

  • 小幺鸡的话效率太慢了,每次都要复制生成好的json,如果接口做了修改,也要手动去修改小幺鸡的文档

  • swagger 的话 侵入式太强了,感觉有点不习惯例如

  • @Data
    @ApiModel(description = "仓库回调商品退款参数")
    @JsonPropertyOrder(alphabetic = true)
    public class ConcurReturn {
    	 @NotBlank(message = "商城订单号不能为空")
    	 @ApiModelProperty(value = "商城订单号", required = true, dataType = "String")
    	 private String orderNo;
    
     @NotBlank(message = "商城退单号不能为空")
     @ApiModelProperty(value = "商城退单号", required = true, dataType = "String")
     private String returnNo;
     
     @NotBlank(message = "物流单号不能为空")
     @ApiModelProperty(value = "物流单号", required = true, dataType = "String")
     private String expressNumber;
     
     @NotBlank(message = "商品sku不能为空")
     @ApiModelProperty(value = "商品sku", required = true, dataType = "String")
     private String sku;
     
     @NotBlank(message = "仓库名称不能为空")
     @ApiModelProperty(value = "仓库名称", required = true, dataType = "String")
     private String warehouseName;
     
     @NotNull(message = "仓库id不能为空")
     @ApiModelProperty(value = "仓库id", required = true, dataType = "int")
     private Integer warehouseId;
     
     @NotNull(message = "收货时间不能为空")
     @ApiModelProperty(value = "收货时间", required = true, dataType = "Long")
     private Long receivingTime;
     
     @NotNull(message = "仓库实收数量不能为空")
     @Min(value = 0, message = "实收数量有误")
     @ApiModelProperty(value = "仓库实收数量 0:为空包裹等,拒绝收货,售后关闭", required = true, dataType = "int")
     private Integer netReceiptsQty;
     
     @Min(value = 0, message = "不良品数量有误")
     @ApiModelProperty(value = "不良品数量", required = false, dataType = "int")
     private Integer rejectsQty;
     
     @ApiModelProperty(value = "备注", required = false, dataType = "String")
     private String remarks;
    

    所以说 我用的是yapi,+ idea 的插件easy-yapi

    easy-yapi:https://github.com/tangcent/easy-yapi/blob/master/docs/cn/Home.md

    • yapi定制版easy-api
    • easy-api的基础上增加对yapi的支持
    • 如果你对easy-api有兴趣或者希望支持其他第三方API管理平台,那么这也是一个很好的例子,通过对比easy-apieasy-yapi的差异,可以了解到如何在 easy-api的基础上开发,使其得以支持第三方API管理平台
    yapi相关参数配置
    • 在导出过程中如果需要yapi相关参数,将会以弹窗的方式提供输入
    • 也可以在Preferences(Settings) > Other Settings > EasyApi 中手动配置
      首次使用此插件时,建议开启inferEnable,这将允许插件在遇到不确定的方法返回类型(Object,Some)时尝试通过代码流进行推断,并根据项目需求设置maxDeep(最大推断深度)
    • 需要提供的参数有
      • server 即部署的yapi地址,如:http://127.0.0.1:3000/
      • tokens 即yapi项目中用于请求项目openapi的私有token,获取方式为 项目->设置->token 配置 -> 工具标识

    yapi:https://github.com/YMFE/yapi

    通过 idea–>code

生成接口文档即可

  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值