我刚开始研究spring-restdocs,我真的很喜欢这种记录API的方式。现在我想用python扩展生成的示例。这意味着我想要像curl这样的代码片段仅用于python。
这是我到目前为止发现的:
我必须创建我自己的模板,比如default-curl-request.snippet。然后用org.springframework.restdocs.snippet.TemplatedSnippet?扩展我自己的实现,对吗?
发布于 2017-04-28 21:31:15
如果您想要使用模板来生成代码片段,那么您所描述的就是正确的方法。
请注意,您不必使用模板。您可以选择直接实现Snippet接口,然后可以使用您喜欢的任何方式生成代码片段。采用这种方法的Here's a snippet implementation from a third-party extensions。
https://stackoverflow.com/questions/43373154
复制相似问题