0

I have started to use Spring Rest Docs for a project but other APIs in the company are still using Swagger/OpenAPI which has led to a style inconsistency.

The usual Swagger view (e.g. https://petstore.swagger.io) has collapsible sections for each url and CSS colouring GET/POST/PUT/DELETE etc.

I should be able to customise the asciidoctor with a line in the adoc

:stylesheet: custom.css

Is there an existing template for Spring Rest Docs that gives an output similar to what the default Swagger output looks like?

Can you add javascript to the asciidoctor output to animate some of the documentation like collapsible url sections?

opticyclic
  • 7,412
  • 12
  • 81
  • 155

2 Answers2

0

This is really any Asciidoctor question so you might want to tag it as such.

Is there an existing template for Spring Rest Docs that gives an output similar to what the default Swagger output looks like?

Not that I am aware of.

Can you add javascript to the asciidoctor output to animate some of the documentation like collapsible url sections?

Yes, you can add JavaScript to the HTML that's generated by Asciidoctor. One approach is described in the answers to this question. Another approach is to use a DocinfoProcessor to inject the JavaScript into the <head> of the generated HTML. One advantage of the latter approach is that it allows the functionality to be packaged as a dependency and reused. You can see an example of a fairly simple DocinfoProcessor here.

Andy Wilkinson
  • 108,729
  • 24
  • 257
  • 242
0

Take a look at this Github project: https://github.com/ePages-de/restdocs-api-spec

A few teams at my company are using this to generate OpenAPI documentation from our Sprint Rest Doc tests.

Brandon Oakley
  • 310
  • 4
  • 6