Skip to content

Get the data of the rendering API document

shalousun edited this page Dec 23, 2020 · 4 revisions

If you don't want to use smart-doc's current default API document template, then you can use smart-doc's open data interface to get the data of the rendered document to customize your own API documentation.

@Test
Public void testBuilderControllersApi() {
     // ApiConfig detailed configuration reference other documents
    ApiConfig config = new ApiConfig();
     // Get the api data
    ApiAllData apiAllData = ApiDataBuilder.getApiData(config);
    // Get the api data converted into a tree
    ApiAllData docList = ApiDataBuilder.getApiDataTree(config);
}

The fields information of the returned data is as follows:

Field Type Description Since
Order int api interface order (controller order) 1.7.0+
Name string controller class name -
Alias string controller name alias after md5 1.7.0+
List of interfaces in list array controller -
└─methodId string method id, use controller+method to do md5 to take 32 bit 1.7.3+
└─method string controller method name 1.7.3+
└─order int interface serial number, automatic sorting 1.7.0+
└─desc string interface description -
└─url string interface url -
└─type string Request type: post, get, etc. -
└─headers string string type header splicing, just to reduce the number of headers rendered in the template rendering -
└─contentType string http contentType -
└─requestHeaders array http request header list -
     └─name string Request header name -
     └─type string Request header type -
     └─desc string Request header description -
     └─required boolean required flag 1.7.0+
     └─since string Starting version number 1.7.0+
└─requestParams array http request params -
     └─field string field -
     └─type string field type -
     └─desc string description -
     └─required boolean require flag -
     └─version string version -
└─requestUsage string http request usage -
└─responseUsage string http response usage -
└─responseParams array http response params -
     └─field string field -
     └─type string field type -
     └─desc string description -
     └─required boolean require flag -
     └─version string version -
desc string method description -