Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error picking up user templates #560

Open
1 task done
MikeAdamsMews opened this issue Feb 8, 2024 · 1 comment
Open
1 task done

Error picking up user templates #560

MikeAdamsMews opened this issue Feb 8, 2024 · 1 comment

Comments

@MikeAdamsMews
Copy link

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

@MikeAdamsMews
Copy link
Author

I have resolved the issue by pointing to the openapi3 sub-directory, not the main templates directory, i.e. command-line should be as follows:
widdershins 'swagger.yaml' -o 'openapi.md' -u 'mytemplates/openapi3'
However, I think the issue I raised is still valid. A small change to the documentation could save users hours of lost time, and others might not be as persistent as me. Thks :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant