如何在 Thrift IDL 中编写 "javadoc" 语句?

How to write "javadoc" statements in Thrift IDL?

Thrift 有一个 html 生成器:

(thrift --help)

html (HTML):
standalone:      Self-contained mode, includes all CSS in the HTML files.
                 Generates no style.css file, but HTML files will be larger.

如果这样写struct

/**
* This is description of struct MyStruct
**/
struct MyStruct {
    1: required i32 fieldOne = 2
}

运行 thrift --gen html 创建一个 html 页面,其部分如下:

Struct MyStruct

|Key|Field   |Type|Description|Requiredness|Default value|
|---|--------|----|-----------|------------|-------------|
|1  |fieldOne|i32 |           |required    |2            |

This is description of struct MyStruct

但是我没有找到如何填写 description 字段?

问得好,这很难猜,而且没有很好的记录(是的,我很慷慨)。答案如下:

struct MyStruct {
     /** This is how you add a description to a struct field */
     1: required i32 fieldOne = 2
}