我想让Capo Mastro成为Java中@ApiOperation批注中可笑的可点击链接,但是我没有任何结果。

@ApiOperation(
        value = "This method updates an existing capo mastro."+" <a href>Capo mastro<a>"+ can be managed only by system",
        response = SaveCapoMastroResponse.class
    )


如果有人可以帮忙,我将不胜感激!谢谢!

最佳答案

假设您的意思是在Swagger UI中可点击–您可以使用Markdown语法在操作说明(notes属性)中添加链接。但操作摘要(value)不支持Markdown。

@ApiOperation(
        value = "This method updates an existing capo mastro.",
        notes = "[Capo mastro](http://example.com) can be managed only by system.",
        response = SaveCapoMastroResponse.class
    )


HTML <a href="">标记也应该起作用,因为Markdown支持HTML。确保转义内部"引号。

@ApiOperation(
        value = "This method updates an existing capo mastro.",
        notes = "<a href=\"http://example.com\" target=\"_blank\">Capo mastro</a> can be managed only by system.",
        response = SaveCapoMastroResponse.class
    )

07-26 02:51