spring-projects / spring-restdocs

Test-driven documentation for RESTful services
https://spring.io/projects/spring-restdocs
Apache License 2.0
1.16k stars 734 forks source link

Provide a Gradle plugin that applies REST Docs' configuration conventions #625

Open wilkinsona opened 5 years ago

wilkinsona commented 5 years ago

When you use REST Docs with Gradle there are a few things that need to be configured:

  1. snippetsDir extra property
  2. Additional output directory on the test task that points to the snippets directory

When you're also using Asciidoctor the following also needs to be configured:

  1. spring-restdocs-asciidoctor extension
  2. Additional input directory on the asciidoctor task that points to the snippets directory
  3. A dependency on the test task from the asciidoctor task

This configuration could be encapsulated in a plugin that applies these conventions, or a variant of them, automatically.

jnizet commented 5 years ago

Here are my comments on this issue.

First, I agree that having a plugin would be nice.

Regarding the plugin, my main fear is that it is too opinionated (or not flexible enough, i.e. not allowing to change its opinions):

I also wonder if spring rest docs shouldn't create its own task rather than using the the default asciidoctor task created by the asciidoctor plugin. Here's why I think it could be a good idea: