2016-12-15 30 views
1

我使用Spring RestDoc和AsciiDoc一起來描述我的rest api。 RestDoc生成不同的文件,這取決於是否有描述的請求參數/響應字段等。我想有一個模板有條件地包括任何文件存在。有條件的包含在asciidoc中

是這樣的:

Request: 

include::{reqresPath}/http-request.adoc[] 

Response: 
include::{reqresPath}/http-response.adoc[] 

Parameters: 
ifeval::[{{reqresPath}/request-parameters.adoc}.exists] 
    include::{reqresPath}/request-parameters.adoc[] 
endif::[] 
ifeval::[{{reqresPath}/request-parameters.adoc}.exists] 
    include::{reqresPath}/request-parameters.adoc[] 
endif::[] 

,或者至少排除文件丟失的情況下警告。但我無法弄清楚如何抑制這些。

回答

0

最極端的方法是使被列入其中產生的空段自定義TemplatedSnippet ...

我希望有一個更好的辦法來做到這一點。

編輯: 看看的​​