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

希望增加对枚举的支持 #29

Open
dazhu6666 opened this issue Nov 12, 2021 · 12 comments
Open

希望增加对枚举的支持 #29

dazhu6666 opened this issue Nov 12, 2021 · 12 comments

Comments

@dazhu6666
Copy link

枚举目前无法正常显示。

@JayWadeH
Copy link

JayWadeH commented Dec 15, 2021

@luoyunchong 枚举支持能否增加下?

@luoyunchong
Copy link
Owner

这里不是前端项目, 界面问题找上层依赖仓库处理。

https://gitee.com/xiaoym/knife4j/tree/master/knife4j-vue

@luoyunchong
Copy link
Owner

image

目前响应参数是支持的。。请求参数和请求示例 不正确

@JayWadeH
Copy link

image

目前响应参数是支持的。。请求参数和请求示例 不正确

枚举还是没有吗?

@dazhu6666
Copy link
Author

@luoyunchong header能自定义不?

@pwcs
Copy link

pwcs commented Oct 13, 2022

QQ截图20221013095637
QQ截图20221013095622
增加一个过滤器就有了,我的是net6 ,希望对大家有帮助
public class SwaggerSchemaFilter : ISchemaFilter
{
public void Apply(OpenApiSchema schema, SchemaFilterContext context)
{
if (context.Type.IsEnum)
{
StringBuilder stringBuilder = new StringBuilder();
Enum.GetNames(context.Type)
.ToList()
.ForEach(name =>
{
Enum e = (Enum)Enum.Parse(context.Type, name);
var data = $"{name}({e.GetEnumDesc()})={Convert.ToInt64(Enum.Parse(context.Type, name))}";
stringBuilder.AppendLine(data);
});
schema.Description = stringBuilder.ToString();
schema.Type = context.Type.Name;
schema.Format = context.Type.Name;
}
}
}

@fanslead
Copy link

这里不是前端项目, 界面问题找上层依赖仓库处理。

https://gitee.com/xiaoym/knife4j/tree/master/knife4j-vue

新版knife4j-vue的界面枚举类型已经做了优化,什么时候更新一下前端UI?

@luoyunchong
Copy link
Owner

有处理吗,最近三个月内的更新好像没看到有关枚举相关的,三个月前更过一版,晚上我试下重新打包一版

@fanslead
Copy link

有处理吗,最近三个月内的更新好像没看到有关枚举相关的,三个月前更过一版,晚上我试下重新打包一版

https://gitee.com/xiaoym/knife4j/issues/I42WM7#note_8048412_link

@luoyunchong
Copy link
Owner

image

@luoyunchong
Copy link
Owner

并没有解决

@fanslead
Copy link

这个PR我看已经合并了的 https://gitee.com/xiaoym/knife4j/pulls/54
image
image
image

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

No branches or pull requests

5 participants