Skip to content

Error picking up user templates #560

Open
@MikeAdamsMews

Description

@MikeAdamsMews

Describe the bug
I cannot get Widdershins to pick up and use my custom template. I'm sure I must be doing something wrong, but it's hard to diagnose when there is no apparent confirmation or otherwise that it is picking up a user template, because the default behavior is to use the standard template.

I'm running Widdershins CLI on Mac with variations of this command:

widdershins 'swagger.yaml' -o 'openapi.md' -u 'mytemplates'

I've tried './mytemplates' instead of 'mytemplates', as well as trying the absolute path obtained through $realpath, but it makes no difference.

I have a sub-directory called mytemplates and in that I have copied the contents of openapi3 from the Widdershins template sub-directory and I've edited the main.dot file with a simple edit to test if it's picking up this version and not the default version. My change is to remove the following line of Markdown which appears in the header of the output file.

> Scroll down for {{? data.header.language_tabs.length}}code samples, {{?}}example requests and responses.{{? data.header.language_tabs.length}} Select a language for code samples from the tabs above or the mobile navigation menu.{{?}}

When I run the command, the deleted Markdown still appears in the output file, indicating that it is not processing my custom main.dot.

I have no indication of the cause of the error:

  • Is it not finding my user template directory, maybe because I have specified it incorrectly?
  • Is there some other reason why it is ignoring my main.dot?

I am pretty sure this must be an error on my part and not in Widdershins, but I'm running out of ideas. And at the very least, it would be good to have some diagnostics support, e.g. if the -u option is used then it should report an error if it can't find or can't process the custom template.

  • - I have checked that my input document is valid OpenAPI 2.0/3.0.x or AsyncAPI 1.x

To Reproduce
Steps to reproduce the behavior:

  1. Command-line: widdershins 'swagger.yaml' -o 'openapi.md' -u 'mytemplates'
  2. My input file: (please link to a gist) swagger.yaml
  3. My user template is mytemplates/openapi3 with main.dot edited as described above.
  4. Output file openapi1.md still contains the Markdown "Scroll down for..." (as above)

Expected behavior
Output file openapi1.md should not contain the Markdown "Scroll down for..." (as above)

Screenshots
n/a

Versions:

  • Node.js (note only LTS versions are supported): v18.11.0 but same result with v20.11.0

Additional context
n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions