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::[]
,或者至少排除文件丢失的情况下警告。但我无法弄清楚如何抑制这些。