Skip to content

[BUG] Inconsistent singleFile behaviour #734

@michael-ball-ctct

Description

@michael-ball-ctct

Describe the bug.

Currently, using the HTML-Template to generate docs, and using the singleFile: 'false' option behaves very weirdly. If it's either 'true' or true then it's fine, but if it's 'false' or false it doesn't behave as you would expect in either case.

The docs for @asyncapi/html-template state this value should be a string.

If it's a string of 'false' (which is a truthy value - likely partially the source of the issue), it incorrectly generates the index.html as the singleFile format - the same as if you were to use a truthy value. However, it ALSO generates the docs as external dependencies, as you would expect it to when the value is set to false.

If it's a boolean of false then it correctly generates the file without the dependencies inside of it, like you would expect. However, it does not generate the external dependencies which it needs to work.

Tested using versions:
Node v22.2.0
@asyncapi/generator: 2.7.0
@asyncapi/parser: 3.4.0
@asyncapi/html-template on 2025-07-11 (so probably pulling v3.3.0)

Stretch goal:

It would also be a nice value add to me if there were additional options to:

  1. intentionally generate the minimal documentation without the external dependencies, for the use case where I'm generate a bunch of different documentation and wish to point it all to the same self-hosted JS/CSS dependencies. This means I can save space and time when generating docs.
  2. generate only the dependencies, which I can run when I build and deploy the server I host those dependencies on.

I understand my use case may not be worth specifically catering to. I can cope with that, it's just a nice-to-have.

Expected behavior

Both false and 'false' behave the same, and generate the minimal documentation which relies on external deps, and also generate those deps.

Screenshots

Image Image

How to Reproduce

https://github.com/michael-ball-ctct/async-api-generator-singlefile-bug-demo

  1. Clone minimal repoduction and navigate to its directory.
  2. npm install.
  3. npm run start.
  4. Read test output/inspect files generated in ./docs

🖥️ Device Information [optional]

  • Operating System (OS): Ubuntu 22.04.5 LTS
  • Browser: N/A
  • Browser Version: N/A

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

Yes I am willing to submit a PR!

NB: In theory, I'm happy to contribute a PR to help push this along. In practice, I'm not really even sure where to start with this as I don't have a deep understanding of the internals of AsyncAPI, and I'm unsure how much time I'll be able to dedicate to this.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingreleased

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions