Skip to content

字段引用了枚举,生成的YAPI文档中不展示枚举中的描述,与插件使用文档中范例不一致 #1151

Answered by tangcent
tauhuang asked this question in Q&A
Discussion options

You must be logged in to vote

现在的处理方式是,选择好哪个字段作为value之后,

  1. 如果剩一个字段没选择,则作为对应的描述,
  2. 如果有注释,用注释
  3. 如果剩多个字段,则把多个字段作为描述
  4. 都没有,直接用枚举的name

这里有个bug, #3 被始终跳过了,所以你看到的就是 key: name -> employee_name: NAME
而我这边的情况多数是1 or 2, 所以没遇到你这个问题 : )


目前来说, 你可以试试这么配:

enum.use.custom[xxx.xxx.xxx.xxx.UserRegisterFieldEnum]=key
field.doc[groovy:it.isEnumField()]=groovy:it.asEnumField().getEnumFields()["params"]?["desc"]

如果支持这样配是不是更简单直观一些? 你有什么想法?

enum.value[xxx.xxx.xxx.xxx.UserRegisterFieldEnum]=key
enum.doc[xxx.xxx.xxx.xxx.UserRegisterFieldEnum]=desc

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@tauhuang
Comment options

Answer selected by tauhuang
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants