Repository: asyncapi/modelina
Pull request #539 (2021-12-21 16:51:55)

feat: complete model rendering and file output for JavaScript generator
**Description**
This PR adds both complete and file output for the JS generator.

**Related issue(s)**
Fixes https://github.com/asyncapi/modelina/issues/400

sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


coveralls: ## Pull Request Test Coverage Report for [Build 1607792654](https://coveralls.io/builds/45165648)

* **18** of **18**   **(100.0%)**  changed or added relevant lines in **3** files are covered.
* No unchanged relevant lines lost coverage.
* Overall coverage increased (+**0.02%**) to **93.213%**

---



|  Totals | [![Coverage Status](https://coveralls.io/builds/45165648/badge)](https://coveralls.io/builds/45165648) |
| :-- | --: |
| Change from base [Build 1587801780](https://coveralls.io/builds/45061793): |  0.02% |
| Covered Lines: | 2315 |
| Relevant Lines: | 2364 |

---
##### 💛  - [Coveralls](https://coveralls.io)

sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


jonaslagoni: @magicmatatjahu I adapted the code to now support different module systems as well as adapted tests.

I also added two examples (why the total changes increased 😅) that show both systems.
jonaslagoni: /rtm
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)


jonaslagoni: /rtm 
sonarcloud[bot]: Kudos, SonarCloud Quality Gate passed!&nbsp; &nbsp; ![Quality Gate passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/passed-16px.png 'Quality Gate passed')

[![Bug](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/bug-16px.png 'Bug')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG) [0 Bugs](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=BUG)  
[![Vulnerability](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/vulnerability-16px.png 'Vulnerability')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY) [0 Vulnerabilities](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=VULNERABILITY)  
[![Security Hotspot](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/security_hotspot-16px.png 'Security Hotspot')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT) [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=SECURITY_HOTSPOT)  
[![Code Smell](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/code_smell-16px.png 'Code Smell')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [![A](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/RatingBadge/A-16px.png 'A')](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL) [0 Code Smells](https://sonarcloud.io/project/issues?id=asyncapi_generator-model-sdk&pullRequest=539&resolved=false&types=CODE_SMELL)

[![No Coverage information](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/CoverageChart/NoCoverageInfo-16px.png 'No Coverage information')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539) No Coverage information  
[![0.0%](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/Duplications/3-16px.png '0.0%')](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list) [0.0% Duplication](https://sonarcloud.io/component_measures?id=asyncapi_generator-model-sdk&pullRequest=539&metric=new_duplicated_lines_density&view=list)



Patch:
diff --git a/docs/advanced.md b/docs/advanced.md
index 8c7e41b6..1d22d8cc 100644
--- a/docs/advanced.md
+++ b/docs/advanced.md
@@ -31,7 +31,9 @@ The reason for splitting the functionality is because in certain environments (l
 The file generators all follow the same pattern regardless of output language, which is the following format - `<language>FileGenerator`.
 
 
-Currently only supported for `Java`.
+Supported by:
+- Java
+- JavaScript
 
 > Not support in browsers.
 
diff --git a/docs/languages/JavaScript.md b/docs/languages/JavaScript.md
index 42974ca5..091c1f28 100644
--- a/docs/languages/JavaScript.md
+++ b/docs/languages/JavaScript.md
@@ -1,4 +1,18 @@
 # JavaScript
 There are special use-cases that each language supports; this document pertains to **JavaScript models**.
 
-At the moment, JavaScript models have no specific features.
\ No newline at end of file
+<!-- toc is generated with GitHub Actions do not remove toc markers -->
+
+<!-- toc -->
+
+- [JavaScript](#javascript)
+  - [Rendering complete models to a specific module system](#rendering-complete-models-to-a-specific-module-system)
+
+<!-- tocstop -->
+
+## Rendering complete models to a specific module system
+In some cases you might need to render the complete models to a specific module system such as ESM and CJS.
+
+Check out this [example for a live demonstration how to generate the complete JavaScript models to use ESM module system](../../examples/javascript-use-esm).
+
+Check out this [example for a live demonstration how to generate the complete JavaScript models to use CJS module system](../../examples/javascript-use-cjs).
\ No newline at end of file
diff --git a/examples/README.md b/examples/README.md
index a366461e..354dd6eb 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -20,4 +20,6 @@ This directory contains a series of self-contained examples that you can use as
 - [java-generate-tostring](./java-generate-tostring) - A basic example that shows how to generate models that overwrite the `toString` method
 - [csharp-generate-equals-and-hashcode](./csharp-generate-equals-and-hashcode) - A basic example on how to generate models that overwrite the `Equal` and `GetHashCode` methods
 - [generate-javascript-models](./generate-javascript-models) - A basic example to generate JavaScript data models
-- [generate-java-models](./generate-java-models) - A basic example to generate Java data models
\ No newline at end of file
+- [javascript-use-esm](./javascript-use-esm) - A basic example that generate the models to use ESM module system.
+- [javascript-use-cjs](./javascript-use-cjs) - A basic example that generate the models to use CJS module system.
+- [generate-java-models](./generate-java-models) - A basic example to generate Java data models.
diff --git a/examples/javascript-use-cjs/README.md b/examples/javascript-use-cjs/README.md
new file mode 100644
index 00000000..59c5f7dd
--- /dev/null
+++ b/examples/javascript-use-cjs/README.md
@@ -0,0 +1,17 @@
+# JavaScript models use CJS module system
+
+This example shows how you can generate the models to use CJS module system.
+
+## How to run this example
+
+Run this example using:
+
+```sh
+npm i && npm run start
+```
+
+If you are on Windows, use the `start:windows` script instead:
+
+```sh
+npm i && npm run start:windows
+```
diff --git a/examples/javascript-use-cjs/__snapshots__/index.spec.ts.snap b/examples/javascript-use-cjs/__snapshots__/index.spec.ts.snap
new file mode 100644
index 00000000..9651cb4b
--- /dev/null
+++ b/examples/javascript-use-cjs/__snapshots__/index.spec.ts.snap
@@ -0,0 +1,37 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Should be able to render models to ESM module system and should log expected output to console 1`] = `
+Array [
+  "
+
+class Person {
+  email;
+
+  constructor(input) {
+    this.email = input.email;
+  }
+
+  get email() { return this.email; }
+  set email(email) { this.email = email; }
+}
+module.exports = Person;",
+]
+`;
+
+exports[`Should be able to render models to ESM module system and should log expected output to console 2`] = `
+Array [
+  "const Person = require('./Person');
+
+class Root {
+  person;
+
+  constructor(input) {
+    this.person = input.person;
+  }
+
+  get person() { return this.person; }
+  set person(person) { this.person = person; }
+}
+module.exports = Root;",
+]
+`;
diff --git a/examples/javascript-use-cjs/index.spec.ts b/examples/javascript-use-cjs/index.spec.ts
new file mode 100644
index 00000000..1bdece51
--- /dev/null
+++ b/examples/javascript-use-cjs/index.spec.ts
@@ -0,0 +1,15 @@
+const spy = jest.spyOn(global.console, 'log').mockImplementation(() => { return; });
+import {generate} from './index';
+
+describe('Should be able to render models to ESM module system', () => {
+  afterAll(() => {
+    jest.restoreAllMocks();
+  });
+  test('and should log expected output to console', async () => {
+    await generate();
+    //Generate is called 2x, so even though we expect 2 models, we double it
+    expect(spy.mock.calls.length).toEqual(4);
+    expect(spy.mock.calls[1]).toMatchSnapshot();
+    expect(spy.mock.calls[2]).toMatchSnapshot();
+  });
+});
diff --git a/examples/javascript-use-cjs/index.ts b/examples/javascript-use-cjs/index.ts
new file mode 100644
index 00000000..9aba8f23
--- /dev/null
+++ b/examples/javascript-use-cjs/index.ts
@@ -0,0 +1,33 @@
+import { JavaScriptGenerator } from '../../src';
+
+const generator = new JavaScriptGenerator();
+const jsonSchemaDraft7 = {
+  $schema: 'http://json-schema.org/draft-07/schema#',
+  type: 'object',
+  additionalProperties: false,
+  properties: {
+    person: {
+      type: 'object',
+      additionalProperties: false,
+      properties: {
+        email: {
+          type: 'string',
+          format: 'email'
+        }
+      }
+    }
+  }
+};
+
+export async function generate() : Promise<void> {
+  const models = await generator.generateCompleteModels(
+    jsonSchemaDraft7, 
+    {
+      moduleSystem: 'CJS'
+    }
+  );
+  for (const model of models) {
+    console.log(model.result);
+  }
+}
+generate();
diff --git a/examples/javascript-use-cjs/package-lock.json b/examples/javascript-use-cjs/package-lock.json
new file mode 100644
index 00000000..56ab4e87
--- /dev/null
+++ b/examples/javascript-use-cjs/package-lock.json
@@ -0,0 +1,10 @@
+{
+  "name": "typescript-interface",
+  "lockfileVersion": 2,
+  "requires": true,
+  "packages": {
+    "": {
+      "hasInstallScript": true
+    }
+  }
+}
diff --git a/examples/javascript-use-cjs/package.json b/examples/javascript-use-cjs/package.json
new file mode 100644
index 00000000..889fa77f
--- /dev/null
+++ b/examples/javascript-use-cjs/package.json
@@ -0,0 +1,10 @@
+{
+  "config" : { "example_name" : "javascript-use-cjs" },
+  "scripts": {
+    "install": "cd ../.. && npm i",
+    "start": "../../node_modules/.bin/ts-node --cwd ../../ ./examples/$npm_package_config_example_name/index.ts",
+    "start:windows": "..\\..\\node_modules\\.bin\\ts-node --cwd ..\\..\\ .\\examples\\%npm_package_config_example_name%\\index.ts",
+    "test": "../../node_modules/.bin/jest --config=../../jest.config.js ./examples/$npm_package_config_example_name/index.spec.ts",
+    "test:windows": "..\\..\\node_modules\\.bin\\jest --config=..\\..\\jest.config.js examples/%npm_package_config_example_name%/index.spec.ts"
+  }
+}
diff --git a/examples/javascript-use-esm/README.md b/examples/javascript-use-esm/README.md
new file mode 100644
index 00000000..098d633f
--- /dev/null
+++ b/examples/javascript-use-esm/README.md
@@ -0,0 +1,17 @@
+# JavaScript models use ESM module system
+
+This example shows how you can generate the models to use ESM module system.
+
+## How to run this example
+
+Run this example using:
+
+```sh
+npm i && npm run start
+```
+
+If you are on Windows, use the `start:windows` script instead:
+
+```sh
+npm i && npm run start:windows
+```
diff --git a/examples/javascript-use-esm/__snapshots__/index.spec.ts.snap b/examples/javascript-use-esm/__snapshots__/index.spec.ts.snap
new file mode 100644
index 00000000..db83a4c7
--- /dev/null
+++ b/examples/javascript-use-esm/__snapshots__/index.spec.ts.snap
@@ -0,0 +1,35 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`Should be able to render models to ESM module system and should log expected output to console 1`] = `
+Array [
+  "
+
+export default class Person {
+  email;
+
+  constructor(input) {
+    this.email = input.email;
+  }
+
+  get email() { return this.email; }
+  set email(email) { this.email = email; }
+}",
+]
+`;
+
+exports[`Should be able to render models to ESM module system and should log expected output to console 2`] = `
+Array [
+  "import Person from './Person';
+
+export default class Root {
+  person;
+
+  constructor(input) {
+    this.person = input.person;
+  }
+
+  get person() { return this.person; }
+  set person(person) { this.person = person; }
+}",
+]
+`;
diff --git a/examples/javascript-use-esm/index.spec.ts b/examples/javascript-use-esm/index.spec.ts
new file mode 100644
index 00000000..1bdece51
--- /dev/null
+++ b/examples/javascript-use-esm/index.spec.ts
@@ -0,0 +1,15 @@
+const spy = jest.spyOn(global.console, 'log').mockImplementation(() => { return; });
+import {generate} from './index';
+
+describe('Should be able to render models to ESM module system', () => {
+  afterAll(() => {
+    jest.restoreAllMocks();
+  });
+  test('and should log expected output to console', async () => {
+    await generate();
+    //Generate is called 2x, so even though we expect 2 models, we double it
+    expect(spy.mock.calls.length).toEqual(4);
+    expect(spy.mock.calls[1]).toMatchSnapshot();
+    expect(spy.mock.calls[2]).toMatchSnapshot();
+  });
+});
diff --git a/examples/javascript-use-esm/index.ts b/examples/javascript-use-esm/index.ts
new file mode 100644
index 00000000..24a7bc17
--- /dev/null
+++ b/examples/javascript-use-esm/index.ts
@@ -0,0 +1,33 @@
+import { JavaScriptGenerator } from '../../src';
+
+const generator = new JavaScriptGenerator();
+const jsonSchemaDraft7 = {
+  $schema: 'http://json-schema.org/draft-07/schema#',
+  type: 'object',
+  additionalProperties: false,
+  properties: {
+    person: {
+      type: 'object',
+      additionalProperties: false,
+      properties: {
+        email: {
+          type: 'string',
+          format: 'email'
+        }
+      }
+    }
+  }
+};
+
+export async function generate() : Promise<void> {
+  const models = await generator.generateCompleteModels(
+    jsonSchemaDraft7, 
+    {
+      moduleSystem: 'ESM'
+    }
+  );
+  for (const model of models) {
+    console.log(model.result);
+  }
+}
+generate();
diff --git a/examples/javascript-use-esm/package-lock.json b/examples/javascript-use-esm/package-lock.json
new file mode 100644
index 00000000..56ab4e87
--- /dev/null
+++ b/examples/javascript-use-esm/package-lock.json
@@ -0,0 +1,10 @@
+{
+  "name": "typescript-interface",
+  "lockfileVersion": 2,
+  "requires": true,
+  "packages": {
+    "": {
+      "hasInstallScript": true
+    }
+  }
+}
diff --git a/examples/javascript-use-esm/package.json b/examples/javascript-use-esm/package.json
new file mode 100644
index 00000000..f353147d
--- /dev/null
+++ b/examples/javascript-use-esm/package.json
@@ -0,0 +1,10 @@
+{
+  "config" : { "example_name" : "javascript-module-system" },
+  "scripts": {
+    "install": "cd ../.. && npm i",
+    "start": "../../node_modules/.bin/ts-node --cwd ../../ ./examples/$npm_package_config_example_name/index.ts",
+    "start:windows": "..\\..\\node_modules\\.bin\\ts-node --cwd ..\\..\\ .\\examples\\%npm_package_config_example_name%\\index.ts",
+    "test": "../../node_modules/.bin/jest --config=../../jest.config.js ./examples/$npm_package_config_example_name/index.spec.ts",
+    "test:windows": "..\\..\\node_modules\\.bin\\jest --config=..\\..\\jest.config.js examples/%npm_package_config_example_name%/index.spec.ts"
+  }
+}
diff --git a/package.json b/package.json
index c51c2f92..d3685362 100644
--- a/package.json
+++ b/package.json
@@ -80,7 +80,7 @@
     "lint": "eslint --max-warnings 0 --config .eslintrc .",
     "lint:fix": "eslint --max-warnings 0 --config .eslintrc . --fix",
     "release": "semantic-release",
-    "generate:readme:toc": "markdown-toc -i README.md && markdown-toc -i ./docs/usage.md && markdown-toc -i ./docs/integration.md && markdown-toc -i ./docs/advanced.md && markdown-toc -i ./docs/languages/TypeScript.md && markdown-toc -i ./docs/languages/Java.md && markdown-toc -i ./docs/languages/Csharp.md && markdown-toc -i ./docs/README.md && markdown-toc -i ./docs/generators.md",
+    "generate:readme:toc": "markdown-toc -i README.md && markdown-toc -i ./docs/usage.md && markdown-toc -i ./docs/integration.md && markdown-toc -i ./docs/advanced.md && markdown-toc -i ./docs/languages/TypeScript.md && markdown-toc -i ./docs/languages/Java.md && markdown-toc -i ./docs/languages/JavaScript.md && markdown-toc -i ./docs/languages/Csharp.md && markdown-toc -i ./docs/README.md && markdown-toc -i ./docs/generators.md",
     "generate:assets": "npm run build:prod && npm run docs && npm run generate:readme:toc",
     "bump:version": "npm --no-git-tag-version --allow-same-version version $VERSION",
     "prepublishOnly": "npm run build:prod && npm run generate:readme:toc"
diff --git a/src/generators/javascript/JavaScriptFileGenerator.ts b/src/generators/javascript/JavaScriptFileGenerator.ts
new file mode 100644
index 00000000..39af296e
--- /dev/null
+++ b/src/generators/javascript/JavaScriptFileGenerator.ts
@@ -0,0 +1,24 @@
+import { JavaScriptGenerator, JavaScriptRenderCompleteModelOptions } from './';
+import { CommonInputModel, OutputModel } from '../../models';
+import * as path from 'path';
+import { AbstractFileGenerator } from '../AbstractFileGenerator';
+import { FileHelpers } from '../../helpers';
+
+export class JavaScriptFileGenerator extends JavaScriptGenerator implements AbstractFileGenerator<JavaScriptRenderCompleteModelOptions> {
+  /**
+   * Generates all the models to an output directory each model with their own separate files. 
+   * 
+   * @param input
+   * @param outputDirectory where you want the models generated to
+   * @param options
+   */
+  public async generateToFiles(input: Record<string, unknown> | CommonInputModel, outputDirectory: string, options?: JavaScriptRenderCompleteModelOptions): Promise<OutputModel[]> {
+    let generatedModels = await this.generateCompleteModels(input, options || {});
+    generatedModels = generatedModels.filter((outputModel) => { return outputModel.modelName !== undefined; });
+    for (const outputModel of generatedModels) {
+      const filePath = path.resolve(outputDirectory, `${outputModel.modelName}.js`);
+      await FileHelpers.writerToFileSystem(outputModel.result, filePath);
+    }
+    return generatedModels;
+  }
+}
diff --git a/src/generators/javascript/JavaScriptGenerator.ts b/src/generators/javascript/JavaScriptGenerator.ts
index 0801c1a8..9ae43623 100644
--- a/src/generators/javascript/JavaScriptGenerator.ts
+++ b/src/generators/javascript/JavaScriptGenerator.ts
@@ -12,10 +12,14 @@ export interface JavaScriptOptions extends CommonGeneratorOptions<JavaScriptPres
   namingConvention?: CommonNamingConvention
 }
 
+export interface JavaScriptRenderCompleteModelOptions {
+  moduleSystem?: 'ESM' | 'CJS';
+}
+
 /**
  * Generator for JavaScript
  */
-export class JavaScriptGenerator extends AbstractGenerator<JavaScriptOptions> {
+export class JavaScriptGenerator extends AbstractGenerator<JavaScriptOptions, JavaScriptRenderCompleteModelOptions> {
   static defaultOptions: JavaScriptOptions = {
     ...defaultGeneratorOptions,
     defaultPreset: JS_DEFAULT_PRESET,
@@ -27,9 +31,33 @@ export class JavaScriptGenerator extends AbstractGenerator<JavaScriptOptions> {
   ) {
     super('JavaScript', JavaScriptGenerator.defaultOptions, options);
   }
+  
+  /**
+   * Render a complete model result where the model code, library and model dependencies are all bundled appropriately.
+   *
+   * @param model
+   * @param inputModel
+   * @param options
+   */
+  // eslint-disable-next-line @typescript-eslint/no-unused-vars
+  async renderCompleteModel(model: CommonModel, inputModel: CommonInputModel, options: JavaScriptRenderCompleteModelOptions): Promise<RenderOutput> {
+    const outputModel = await this.render(model, inputModel);
+    const modelDependencies = model.getNearestDependencies().map((dependencyModelName) => {
+      const formattedDependencyModelName = this.options.namingConvention?.type ? this.options.namingConvention.type(dependencyModelName, { inputModel, model: inputModel.models[String(dependencyModelName)] }) : dependencyModelName;
+      if (options.moduleSystem === 'CJS') {
+        return `const ${formattedDependencyModelName} = require('./${formattedDependencyModelName}');`;
+      }
+      return `import ${formattedDependencyModelName} from './${formattedDependencyModelName}';`;
+    });
+    let modelCode = `export default ${outputModel.result}`;
+    if (options.moduleSystem === 'CJS') {
+      modelCode = `${outputModel.result}
+module.exports = ${outputModel.renderedName};`;
+    }
+    const outputContent = `${[...modelDependencies, ...outputModel.dependencies].join('\n')}
 
-  renderCompleteModel(): Promise<RenderOutput> {
-    throw new Error('Method not implemented.');
+${modelCode}`;
+    return RenderOutput.toRenderOutput({ result: outputContent, renderedName: outputModel.renderedName, dependencies: outputModel.dependencies });
   }
 
   render(model: CommonModel, inputModel: CommonInputModel): Promise<RenderOutput> {
diff --git a/src/generators/javascript/index.ts b/src/generators/javascript/index.ts
index 60badf1b..e9839415 100644
--- a/src/generators/javascript/index.ts
+++ b/src/generators/javascript/index.ts
@@ -1,3 +1,4 @@
 export * from './JavaScriptGenerator';
+export * from './JavaScriptFileGenerator';
 export { JS_DEFAULT_PRESET } from './JavaScriptPreset';
 export type { JavaScriptPreset } from './JavaScriptPreset';


Test patch:
diff --git a/test/generators/javascript/JavaScriptFileGenerator.spec.ts b/test/generators/javascript/JavaScriptFileGenerator.spec.ts
new file mode 100644
index 00000000..69a4803f
--- /dev/null
+++ b/test/generators/javascript/JavaScriptFileGenerator.spec.ts
@@ -0,0 +1,51 @@
+import { CommonInputModel, CommonModel, FileHelpers, JavaScriptFileGenerator, OutputModel } from '../../../src';
+import * as path from 'path';
+
+describe('JavaScriptFileGenerator', () => {
+  afterEach(() => {
+    jest.restoreAllMocks();
+  });
+
+  describe('generateToFile()', () => {
+    const doc = {
+      $id: 'CustomClass',
+      type: 'object',
+      additionalProperties: true,
+      properties: {
+        someProp: { type: 'string' },
+        someEnum: {
+          $id: 'CustomEnum',
+          type: 'string',
+          enum: ['Texas', 'Alabama', 'California'],
+        }
+      }
+    };
+    test('should throw accurate error if file cannot be written', async () => {
+      const generator = new JavaScriptFileGenerator();
+      const expectedError = new Error('write error');
+      jest.spyOn(FileHelpers, 'writerToFileSystem').mockRejectedValue(expectedError);
+      jest.spyOn(generator, 'generateCompleteModels').mockResolvedValue([new OutputModel('content', new CommonModel(), '', new CommonInputModel(), [])]);
+    
+      await expect(generator.generateToFiles(doc, '/test/')).rejects.toEqual(expectedError);
+      expect(generator.generateCompleteModels).toHaveBeenCalledTimes(1);
+      expect(FileHelpers.writerToFileSystem).toHaveBeenCalledTimes(1);
+    });
+    test('should try and generate models to files', async () => {
+      const generator = new JavaScriptFileGenerator();
+      const outputDir = './test';
+      const expectedOutputDirPath = path.resolve(outputDir);
+      const expectedOutputFilePath = path.resolve(`${outputDir}/Test.js`);
+      const expectedWriteToFileParameters = [
+        'content',
+        expectedOutputFilePath,
+      ];
+      jest.spyOn(FileHelpers, 'writerToFileSystem').mockResolvedValue(undefined);
+      jest.spyOn(generator, 'generateCompleteModels').mockResolvedValue([new OutputModel('content', new CommonModel(), 'Test', new CommonInputModel(), [])]);
+      
+      await generator.generateToFiles(doc, expectedOutputDirPath);
+      expect(generator.generateCompleteModels).toHaveBeenCalledTimes(1);
+      expect(FileHelpers.writerToFileSystem).toHaveBeenCalledTimes(1);
+      expect((FileHelpers.writerToFileSystem as jest.Mock).mock.calls[0]).toEqual(expectedWriteToFileParameters);
+    });
+  });
+});
diff --git a/test/generators/javascript/JavaScriptGenerator.spec.ts b/test/generators/javascript/JavaScriptGenerator.spec.ts
index 44da7d15..185e8ef1 100644
--- a/test/generators/javascript/JavaScriptGenerator.spec.ts
+++ b/test/generators/javascript/JavaScriptGenerator.spec.ts
@@ -188,4 +188,57 @@ describe('JavaScriptGenerator', () => {
     expect(classModel.result).toEqual(expected);
     expect(classModel.dependencies).toEqual([]);
   });
+
+  test('should render models and their dependencies for CJS module system', async () => {
+    const doc = {
+      $id: 'Address',
+      type: 'object',
+      properties: {
+        street_name: { type: 'string' },
+        city: { type: 'string', description: 'City description' },
+        state: { type: 'string' },
+        house_number: { type: 'number' },
+        marriage: { type: 'boolean', description: 'Status if marriage live in given house' },
+        members: { oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }], },
+        array_type: { type: 'array', items: [{ type: 'string' }, { type: 'number' }] },
+        other_model: { type: 'object', $id: 'OtherModel', properties: { street_name: { type: 'string' } } },
+      },
+      patternProperties: {
+        '^S(.?*)test&': {
+          type: 'string'
+        }
+      },
+      required: ['street_name', 'city', 'state', 'house_number', 'array_type'],
+    };
+    const models = await generator.generateCompleteModels(doc, {moduleSystem: 'CJS'});
+    expect(models).toHaveLength(2);
+    expect(models[0].result).toMatchSnapshot();
+    expect(models[1].result).toMatchSnapshot();
+  });
+  test('should render models and their dependencies for ESM module system', async () => {
+    const doc = {
+      $id: 'Address',
+      type: 'object',
+      properties: {
+        street_name: { type: 'string' },
+        city: { type: 'string', description: 'City description' },
+        state: { type: 'string' },
+        house_number: { type: 'number' },
+        marriage: { type: 'boolean', description: 'Status if marriage live in given house' },
+        members: { oneOf: [{ type: 'string' }, { type: 'number' }, { type: 'boolean' }], },
+        array_type: { type: 'array', items: [{ type: 'string' }, { type: 'number' }] },
+        other_model: { type: 'object', $id: 'OtherModel', properties: { street_name: { type: 'string' } } },
+      },
+      patternProperties: {
+        '^S(.?*)test&': {
+          type: 'string'
+        }
+      },
+      required: ['street_name', 'city', 'state', 'house_number', 'array_type'],
+    };
+    const models = await generator.generateCompleteModels(doc, {moduleSystem: 'ESM'});
+    expect(models).toHaveLength(2);
+    expect(models[0].result).toMatchSnapshot();
+    expect(models[1].result).toMatchSnapshot();
+  });
 });
diff --git a/test/generators/javascript/__snapshots__/JavaScriptGenerator.spec.ts.snap b/test/generators/javascript/__snapshots__/JavaScriptGenerator.spec.ts.snap
new file mode 100644
index 00000000..8ff9e784
--- /dev/null
+++ b/test/generators/javascript/__snapshots__/JavaScriptGenerator.spec.ts.snap
@@ -0,0 +1,157 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`JavaScriptGenerator should render models and their dependencies for CJS module system 1`] = `
+"const OtherModel = require('./OtherModel');
+
+class Address {
+  streetName;
+  city;
+  state;
+  houseNumber;
+  marriage;
+  members;
+  arrayType;
+  otherModel;
+  additionalProperties;
+  sTestPatternProperties;
+
+  constructor(input) {
+    this.streetName = input.streetName;
+    this.city = input.city;
+    this.state = input.state;
+    this.houseNumber = input.houseNumber;
+    this.marriage = input.marriage;
+    this.members = input.members;
+    this.arrayType = input.arrayType;
+    this.otherModel = input.otherModel;
+  }
+
+  get streetName() { return this.streetName; }
+  set streetName(streetName) { this.streetName = streetName; }
+
+  get city() { return this.city; }
+  set city(city) { this.city = city; }
+
+  get state() { return this.state; }
+  set state(state) { this.state = state; }
+
+  get houseNumber() { return this.houseNumber; }
+  set houseNumber(houseNumber) { this.houseNumber = houseNumber; }
+
+  get marriage() { return this.marriage; }
+  set marriage(marriage) { this.marriage = marriage; }
+
+  get members() { return this.members; }
+  set members(members) { this.members = members; }
+
+  get arrayType() { return this.arrayType; }
+  set arrayType(arrayType) { this.arrayType = arrayType; }
+
+  get otherModel() { return this.otherModel; }
+  set otherModel(otherModel) { this.otherModel = otherModel; }
+
+  get additionalProperties() { return this.additionalProperties; }
+  set additionalProperties(additionalProperties) { this.additionalProperties = additionalProperties; }
+
+  get sTestPatternProperties() { return this.sTestPatternProperties; }
+  set sTestPatternProperties(sTestPatternProperties) { this.sTestPatternProperties = sTestPatternProperties; }
+}
+module.exports = Address;"
+`;
+
+exports[`JavaScriptGenerator should render models and their dependencies for CJS module system 2`] = `
+"
+
+class OtherModel {
+  streetName;
+  additionalProperties;
+
+  constructor(input) {
+    this.streetName = input.streetName;
+  }
+
+  get streetName() { return this.streetName; }
+  set streetName(streetName) { this.streetName = streetName; }
+
+  get additionalProperties() { return this.additionalProperties; }
+  set additionalProperties(additionalProperties) { this.additionalProperties = additionalProperties; }
+}
+module.exports = OtherModel;"
+`;
+
+exports[`JavaScriptGenerator should render models and their dependencies for ESM module system 1`] = `
+"import OtherModel from './OtherModel';
+
+export default class Address {
+  streetName;
+  city;
+  state;
+  houseNumber;
+  marriage;
+  members;
+  arrayType;
+  otherModel;
+  additionalProperties;
+  sTestPatternProperties;
+
+  constructor(input) {
+    this.streetName = input.streetName;
+    this.city = input.city;
+    this.state = input.state;
+    this.houseNumber = input.houseNumber;
+    this.marriage = input.marriage;
+    this.members = input.members;
+    this.arrayType = input.arrayType;
+    this.otherModel = input.otherModel;
+  }
+
+  get streetName() { return this.streetName; }
+  set streetName(streetName) { this.streetName = streetName; }
+
+  get city() { return this.city; }
+  set city(city) { this.city = city; }
+
+  get state() { return this.state; }
+  set state(state) { this.state = state; }
+
+  get houseNumber() { return this.houseNumber; }
+  set houseNumber(houseNumber) { this.houseNumber = houseNumber; }
+
+  get marriage() { return this.marriage; }
+  set marriage(marriage) { this.marriage = marriage; }
+
+  get members() { return this.members; }
+  set members(members) { this.members = members; }
+
+  get arrayType() { return this.arrayType; }
+  set arrayType(arrayType) { this.arrayType = arrayType; }
+
+  get otherModel() { return this.otherModel; }
+  set otherModel(otherModel) { this.otherModel = otherModel; }
+
+  get additionalProperties() { return this.additionalProperties; }
+  set additionalProperties(additionalProperties) { this.additionalProperties = additionalProperties; }
+
+  get sTestPatternProperties() { return this.sTestPatternProperties; }
+  set sTestPatternProperties(sTestPatternProperties) { this.sTestPatternProperties = sTestPatternProperties; }
+}"
+`;
+
+exports[`JavaScriptGenerator should render models and their dependencies for ESM module system 2`] = `
+"
+
+export default class OtherModel {
+  streetName;
+  additionalProperties;
+
+  constructor(input) {
+    this.streetName = input.streetName;
+  }
+
+  get streetName() { return this.streetName; }
+  set streetName(streetName) { this.streetName = streetName; }
+
+  get additionalProperties() { return this.additionalProperties; }
+  set additionalProperties(additionalProperties) { this.additionalProperties = additionalProperties; }
+}"
+`;