fix: coerce singleFile strings->bools so non-singleFile won't bundle deps#735
Merged
asyncapi-bot merged 1 commit intoasyncapi:masterfrom Jul 15, 2025
Conversation
There was a problem hiding this comment.
Welcome to AsyncAPI. Thanks a lot for creating your first pull request. Please check out our contributors guide useful for opening a pull request.
Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.
|
Member
|
/rtm |
Contributor
|
🎉 This PR is included in version 3.3.1 🎉 The release is available on: Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
Currently html-template parses the string
'false'astruebecause it is a non-empty string. This leads to the html file that is generated being created with its dependencies built in, when it should not.By coercing this value to a boolean, this change ensures that only strings that match
'true'or true boolean values will match the singleFile behaviour, and otherwise stick to the default non-singleFile behaviour. Other strings (including'false') will generate non-singleFile documentation.This behaviour satisfies the TypeScript contract which states that the value of the
singleFileoptional param must be a string. It does not solve the behaviour that if AsyncAPI/generator is given a singleFile param of afalseboolean it will generate a non-singleFile formattedindex.htmlwhile failing to also generate the dependency files non-singleFiles refer to. This is because A) fixing this behaviour appears to be outside of the html-template repo and B) that's outside of the aforementioned expected types supported, as per the TypeScript definition.Using the test repo I created for #734 and pointing the template towards this repo will show a fixed case for
singleFileFalseString(but notsingleFileFalseBoolean, as discussed above).Related documentation
None, other than the code comment explaining the coercion - which can be removed/amended if not fitting with repo style. This change is ensuring behaviour matches existing TypeScript + written documentation.
Related issue(s)
Fixes #734
Test results