We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
@tag name属性 和 @operation summary属性 字符'/' 在文档页面中展示时被替换为 '-'
接口代码
@Tag(name = "A/B") @RestController @RequestMapping("/") public class DemoApi { @Operation(summary = "C/D") @GetMapping("test") public String test() { return "success"; } }
文档显示效果,其中接口组名和接口名均不正确
使用版本
<dependency> <groupId>com.github.xiaoymin</groupId> <artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId> <version>4.5.0</version> </dependency>
我在 Knife4jAsync.js:5136 文件中找到相关替换代码
swpinfo.summary = KUtils.toString(apiInfo.summary, '').replace(/\//g, '-'); // 针对summary做一次非空判断 if (KUtils.strBlank(swpinfo.summary)) { swpinfo.summary = apiInfo.operationId; } //处理tags,预防存在带/的情况,导致与Knife4j的路由冲突 let _apiTags = []; if (KUtils.arrNotEmpty(apiInfo.tags)) { apiInfo.tags.forEach(_tag => { _apiTags.push(KUtils.toString(_tag, '').replace(/\//g, '-')); }) }
可以将'/'存入变量时转换为实体名称⁄,页面展示时再转换回来,这样可以保证页面展示内容和代码注解上所填信息一致
⁄
The text was updated successfully, but these errors were encountered:
⁄是什么字符?
knife4j的路由是有二级、三级路由,用/字符的,summary如果冲突的话,写一个notes再说明一下吧
/
Sorry, something went wrong.
⁄ 是 /的实体名称,在一些非特殊情况html会将其渲染为/
效果如下
不涉及后端请求的话repace成-或者⁄影响应该是相同的,其他特殊字符也可用替换成相应的实体名称避免问题
-
notes可以临时解决一下问题,还是希望能优化一下这一部分
No branches or pull requests
@tag name属性 和 @operation summary属性 字符'/' 在文档页面中展示时被替换为 '-'
接口代码
文档显示效果,其中接口组名和接口名均不正确
使用版本
我在 Knife4jAsync.js:5136 文件中找到相关替换代码
可以将'/'存入变量时转换为实体名称
⁄
,页面展示时再转换回来,这样可以保证页面展示内容和代码注解上所填信息一致The text was updated successfully, but these errors were encountered: