question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature request: Add option to generate one markdown file per swagger tag

See original GitHub issue

Widdershins seems to assume that you have only one Swagger/OpenApi-File which contains the whole API specification and generates a single markdown file from that.

It would be nice to be able to split the result into multiple files (which can then be referenced via the Slate “includes” option) as this would easy maintainability and allow to reuse the generated markdown in other contexts. Also it may help in cases where the final markdown file should contain manually created includes (i.e. content that is not originally maintained in the swagger/OpenApi specification).

What I have in mind is an additional option, that for example results in the generation of one markdown file per swagger-tag (https://swagger.io/docs/specification/grouping-operations-with-tags/). For example if you have:

  /pet/findByStatus:
    get:
      summary: Finds pets by Status
      tags:
        - cat
      ...
  /pet:
    post:
      summary: Adds a new pet to the store
      tags:
        - mouse
      ...

This would generate three files:

  • One main “index.md” which has includes for the generated files “cat.md” and “mouse.md”.
  • The file “cat.md”
  • The file “mouse.md”

Maybe there are also other criteria by which the content should be split, but using tags would fit our use case.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
MikeRalphsoncommented, Jun 28, 2018

If you don’t plan any direct support for includes (for the reasons you listed above), this issue can be closed from my side as the workaround works.

I’m not opposed to adding a third method (!) for includes, but I don’t think I can see how they can be incorporated in the stock templates when they’re not known in advance.

Feel free to re-open that discussion at any time, but let’s close on the idea of generating multiple .md files per tag for now.

0reactions
geld0rcommented, May 14, 2018

Sorry, this got lost. Yes I did try this out and added includes in “main.dot”, like this:

<%= partial "includes/yourFileName.md" %> This makes use of Middleman partials. Our source file is now a index.html.md.erb (yes, really), but includes work this way. The downisde is that (as you said) we had to override the stock templates. This makes version updates quite tricky as one has to take care of merging the changes. Apart from that, this solution works fine.

If you don’t plan any direct support for includes (for the reasons you listed above), this issue can be closed from my side as the workaround works.

Read more comments on GitHub >

github_iconTop Results From Across the Web

OpenAPI Specification - Version 3.0.3 - Swagger
A declaration of which security mechanisms can be used across the API. The list of values includes alternative security requirement objects that can...
Read more >
SwaggerHub Feature Requests - SmartBear Community
I'd like to be able to use my own domain for the UI and the swagger spec itself. What I'd like is something...
Read more >
Customization - OpenAPI Generator
Compile a user-provided my_custom_templates/api_interfaces.mustache following our usual API template compilation logic. That is, one file will ...
Read more >
Enriched Web API Documentation using Swagger/OpenAPI in ...
Add a Swagger generator and Automatic Request and Response annotations: ... UseSwaggerUI(options => { // Build a swagger endpoint for each ...
Read more >
Swagger UI tutorial | Documenting APIs - Idratherbewriting.com
In this activity, you'll create a Swagger UI display for an OpenAPI specification document. If you're using one of the pre-built OpenAPI files, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found