mirror of
				https://github.com/OpenAPITools/openapi-generator.git
				synced 2025-10-29 07:43:42 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			170 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
			
		
		
	
	
			170 lines
		
	
	
		
			23 KiB
		
	
	
	
		
			HTML
		
	
	
	
	
	
| <!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>CLI Installation · OpenAPI Generator</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="There are a number of ways to use OpenAPI Generator. This page documents how to install the CLI artifact. "/><meta name="docsearch:language" content="en"/><meta property="og:title" content="CLI Installation · OpenAPI Generator"/><meta property="og:type" content="website"/><meta property="og:url" content="https://openapi-generator.tech/"/><meta property="og:description" content="There are a number of ways to use OpenAPI Generator. This page documents how to install the CLI artifact. "/><meta property="og:image" content="https://openapi-generator.tech/img/docusaurus.png"/><meta name="twitter:card" content="summary"/><meta name="twitter:image" content="https://openapi-generator.tech/img/icons/twitter.svg"/><link rel="shortcut icon" href="/img/favicon.png"/><link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/default.min.css"/><link rel="alternate" type="application/atom+xml" href="https://openapi-generator.tech/blog/atom.xml" title="OpenAPI Generator Blog ATOM Feed"/><link rel="alternate" type="application/rss+xml" href="https://openapi-generator.tech/blog/feed.xml" title="OpenAPI Generator Blog RSS Feed"/><script>
 | ||
|               (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
 | ||
|               (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
 | ||
|               m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
 | ||
|               })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');
 | ||
| 
 | ||
|               ga('create', 'UA-132927057-1', 'auto');
 | ||
|               ga('send', 'pageview');
 | ||
|             </script><script type="text/javascript" src="https://buttons.github.io/buttons.js"></script><script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.0/clipboard.min.js"></script><script type="text/javascript" src="/js/code-block-buttons.js"></script><script src="https://unpkg.com/vanilla-back-to-top@7.1.14/dist/vanilla-back-to-top.min.js"></script><script>
 | ||
|         document.addEventListener('DOMContentLoaded', function() {
 | ||
|           addBackToTop(
 | ||
|             {"zIndex":100}
 | ||
|           )
 | ||
|         });
 | ||
|         </script><script src="/js/scrollSpy.js"></script><link rel="stylesheet" href="/css/main.css"/><script src="/js/codetabs.js"></script></head><body class="sideNavVisible separateOnPageNav"><div class="fixedHeaderContainer"><div class="headerWrapper wrapper"><header><a href="/"><img class="logo" src="/img/mono-logo.svg" alt="OpenAPI Generator"/><h2 class="headerTitleWithLogo">OpenAPI Generator</h2></a><div class="navigationWrapper navigationSlider"><nav class="slidingNav"><ul class="nav-site nav-site-internal"><li class="siteNavGroupActive siteNavItemActive"><a href="/docs/installation" target="_self">Get Started</a></li><li class="siteNavGroupActive"><a href="/docs/generators" target="_self">Generators</a></li><li class="siteNavGroupActive"><a href="/docs/roadmap" target="_self">Roadmap</a></li><li class=""><a href="/team" target="_self">Team</a></li><li class=""><a href="/docs/faq" target="_self">FAQ</a></li><li class=""><a href="/blog/" target="_self">Blog</a></li></ul></nav></div></header></div></div><div class="navPusher"><div class="docMainWrapper wrapper"><div class="docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><div class="hamburger-menu"><div class="line1"></div><div class="line2"></div><div class="line3"></div></div></div><h2><i>›</i><span>Getting Started</span></h2><div class="tocToggler" id="tocToggler"><i class="icon-toc"></i></div></div><div class="navGroups"><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Getting Started<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem navListItemActive"><a class="navItem" href="/docs/installation">CLI Installation</a></li><li class="navListItem"><a class="navItem" href="/docs/plugins">Plugins</a></li><li class="navListItem"><a class="navItem" href="/docs/online">Online</a></li><li class="navListItem"><a class="navItem" href="/docs/usage">Usage</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Extending<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/templating">Using Templates</a></li><li class="navListItem"><a class="navItem" href="/docs/customization">Customization</a></li><li class="navListItem"><a class="navItem" href="/docs/debugging">Debugging</a></li><li class="navListItem"><a class="navItem" href="/docs/integrations">Workflow Integrations</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Contributing<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/contributing">Guidelines</a></li><li class="navListItem"><a class="navItem" href="/docs/code-of-conduct">Code of Conduct</a></li><li class="navListItem"><a class="navItem" href="/docs/contribute-building">Building the code</a></li><li class="navListItem"><a class="navItem" href="/docs/new-generator">Create a New Generator</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">About<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/roadmap">Roadmap</a></li><li class="navListItem"><a class="navItem" href="/docs/swagger-codegen-migration">Migrating from Swagger Codegen</a></li><li class="navListItem"><a class="navItem" href="/docs/fork-qna">Swagger Codegen Fork: Q&A</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">Releases<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/release-summary">Release Summary</a></li><li class="navListItem"><a class="navItem" href="/docs/release-3-0-0">Release Notes: 3.0.0</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle collapsible">API<span class="arrow"><svg width="24" height="24" viewBox="0 0 24 24"><path fill="#565656" d="M7.41 15.41L12 10.83l4.59 4.58L18 14l-6-6-6 6z"></path><path d="M0 0h24v24H0z" fill="none"></path></svg></span></h3><ul class="hide"><li class="navListItem"><a class="navItem" href="/docs/generators">Generators List</a></li></ul></div></div></section></div><script>
 | ||
|             var coll = document.getElementsByClassName('collapsible');
 | ||
|             var checkActiveCategory = true;
 | ||
|             for (var i = 0; i < coll.length; i++) {
 | ||
|               var links = coll[i].nextElementSibling.getElementsByTagName('*');
 | ||
|               if (checkActiveCategory){
 | ||
|                 for (var j = 0; j < links.length; j++) {
 | ||
|                   if (links[j].classList.contains('navListItemActive')){
 | ||
|                     coll[i].nextElementSibling.classList.toggle('hide');
 | ||
|                     coll[i].childNodes[1].classList.toggle('rotate');
 | ||
|                     checkActiveCategory = false;
 | ||
|                     break;
 | ||
|                   }
 | ||
|                 }
 | ||
|               }
 | ||
| 
 | ||
|               coll[i].addEventListener('click', function() {
 | ||
|                 var arrow = this.childNodes[1];
 | ||
|                 arrow.classList.toggle('rotate');
 | ||
|                 var content = this.nextElementSibling;
 | ||
|                 content.classList.toggle('hide');
 | ||
|               });
 | ||
|             }
 | ||
| 
 | ||
|             document.addEventListener('DOMContentLoaded', function() {
 | ||
|               createToggler('#navToggler', '#docsNav', 'docsSliderActive');
 | ||
|               createToggler('#tocToggler', 'body', 'tocActive');
 | ||
| 
 | ||
|               var headings = document.querySelector('.toc-headings');
 | ||
|               headings && headings.addEventListener('click', function(event) {
 | ||
|                 var el = event.target;
 | ||
|                 while(el !== headings){
 | ||
|                   if (el.tagName === 'A') {
 | ||
|                     document.body.classList.remove('tocActive');
 | ||
|                     break;
 | ||
|                   } else{
 | ||
|                     el = el.parentNode;
 | ||
|                   }
 | ||
|                 }
 | ||
|               }, false);
 | ||
| 
 | ||
|               function createToggler(togglerSelector, targetSelector, className) {
 | ||
|                 var toggler = document.querySelector(togglerSelector);
 | ||
|                 var target = document.querySelector(targetSelector);
 | ||
| 
 | ||
|                 if (!toggler) {
 | ||
|                   return;
 | ||
|                 }
 | ||
| 
 | ||
|                 toggler.onclick = function(event) {
 | ||
|                   event.preventDefault();
 | ||
| 
 | ||
|                   target.classList.toggle(className);
 | ||
|                 };
 | ||
|               }
 | ||
|             });
 | ||
|         </script></nav></div><div class="container mainContainer docsContainer"><div class="wrapper"><div class="post"><header class="postHeader"><h1 id="__docusaurus" class="postHeaderTitle">CLI Installation</h1></header><article><div><span><p>There are a number of ways to use OpenAPI Generator. This page documents how to install the CLI artifact.
 | ||
| Installing OpenAPI Generator's CLI tool allows users to generate all available generators from the command line.</p>
 | ||
| <p>Some of the following are cross-platform options and some are not, these are called out where possible.</p>
 | ||
| <h2><a class="anchor" aria-hidden="true" id="npm"></a><a href="#npm" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>NPM</h2>
 | ||
| <blockquote>
 | ||
| <p><strong>Platform(s)</strong>: Linux, macOS, Windows</p>
 | ||
| </blockquote>
 | ||
| <p>The <a href="https://github.com/openapitools/openapi-generator-cli">NPM package wrapper</a> is cross-platform wrapper around the .jar artifact. It works by providing a CLI wrapper atop the JAR's command line options. This gives a simple interface layer which normalizes usage of the command line across operating systems, removing some differences in how options or switches are passed to the tool (depending on OS).
 | ||
| <strong>Install</strong> the latest version of the tool globally, exposing the CLI on the command line:</p>
 | ||
| <pre><code class="hljs css language-bash">npm install @openapitools/openapi-generator-cli -g
 | ||
| </code></pre>
 | ||
| <p>To install a specific version of the tool, pass the version during installation:</p>
 | ||
| <pre><code class="hljs css language-bash">npm install @openapitools/openapi-generator-cli@cli-3.3.4 -g
 | ||
| </code></pre>
 | ||
| <p>To install the tool as a dev dependency in your current project:</p>
 | ||
| <pre><code class="hljs css language-bash">npm install @openapitools/openapi-generator-cli -D
 | ||
| </code></pre>
 | ||
| <p>Then, <strong>generate</strong> a ruby client from a valid <a href="https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml">petstore.yaml</a> doc:</p>
 | ||
| <pre><code class="hljs css language-bash">npx openapi-generator generate -i petstore.yaml -g ruby -o /tmp/<span class="hljs-built_in">test</span>/
 | ||
| </code></pre>
 | ||
| <blockquote>
 | ||
| <p><code>npx</code> will execute a globally available <code>openapi-generator</code>, and if not found it will fall back to project-local commands. The result is that the above command will work regardless of which installation method you've chosen.</p>
 | ||
| </blockquote>
 | ||
| <h2><a class="anchor" aria-hidden="true" id="homebrew"></a><a href="#homebrew" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Homebrew</h2>
 | ||
| <blockquote>
 | ||
| <p><strong>Platform(s)</strong>: macOS</p>
 | ||
| </blockquote>
 | ||
| <p><strong>Install</strong> via <a href="https://brew.sh/">homebrew</a>:</p>
 | ||
| <pre><code class="hljs css language-bash">brew install openapi-generator
 | ||
| </code></pre>
 | ||
| <p>Then, <strong>generate</strong> a ruby client from a valid <a href="https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml">petstore.yaml</a> doc:</p>
 | ||
| <pre><code class="hljs css language-bash">openapi-generator generate -i petstore.yaml -g ruby -o /tmp/<span class="hljs-built_in">test</span>/
 | ||
| </code></pre>
 | ||
| <h2><a class="anchor" aria-hidden="true" id="docker"></a><a href="#docker" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Docker</h2>
 | ||
| <blockquote>
 | ||
| <p><strong>Platform(s)</strong>: Linux, macOS, Windows</p>
 | ||
| </blockquote>
 | ||
| <p>The OpenAPI Generator Docker image acts as a standalone executable. It can be used as an alternative to installing via homebrew, or for developers who are unable to install Java or upgrade the installed version.</p>
 | ||
| <p>To generate code from a valid <a href="https://raw.githubusercontent.com/openapitools/openapi-generator/master/modules/openapi-generator/src/test/resources/2_0/petstore.yaml">petstore.yaml</a> doc with this image, you'll need to mount a local location as a volume.
 | ||
| You'll then need to output the generated code to this mapped volume. Everything else works the same as if you ran the command on your host machine.</p>
 | ||
| <p>Here's an example generating a Go client:</p>
 | ||
| <pre><code class="hljs css language-bash">docker run --rm \
 | ||
|   -v <span class="hljs-variable">${PWD}</span>:/<span class="hljs-built_in">local</span> openapitools/openapi-generator-cli generate \
 | ||
|   -i /<span class="hljs-built_in">local</span>/petstore.yaml \
 | ||
|   -g go \
 | ||
|   -o /<span class="hljs-built_in">local</span>/out/go
 | ||
| </code></pre>
 | ||
| <h2><a class="anchor" aria-hidden="true" id="jar"></a><a href="#jar" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>JAR</h2>
 | ||
| <blockquote>
 | ||
| <p><strong>Platform(s)</strong>: Linux, macOS, Windows</p>
 | ||
| </blockquote>
 | ||
| <p>If you're looking for the latest stable version, you can grab it directly from Maven.org (Java 8 runtime at a minimum):</p>
 | ||
| <p>JAR location: <code>http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.4/openapi-generator-cli-3.3.4.jar</code></p>
 | ||
| <p>For <strong>Mac/Linux</strong> users:</p>
 | ||
| <pre><code class="hljs css language-bash">wget http://central.maven.org/maven2/org/openapitools/openapi-generator-cli/3.3.4/openapi-generator-cli-3.3.4.jar -O openapi-generator-cli.jar
 | ||
| </code></pre>
 | ||
| <p>For <strong>Windows</strong> users, you will need to install <a href="http://gnuwin32.sourceforge.net/packages/wget.htm">wget</a> or you can use Invoke-WebRequest in PowerShell (3.0+), e.g.</p>
 | ||
| <pre><code class="hljs">Invoke-WebRequest -OutFile openapi-generator-<span class="hljs-keyword">cli</span>.jar http://central.maven<span class="hljs-meta">.org</span>/maven2/org/openapitools/openapi-generator-<span class="hljs-keyword">cli</span>/<span class="hljs-number">3.3</span><span class="hljs-number">.4</span>/openapi-generator-<span class="hljs-keyword">cli</span><span class="hljs-number">-3.3</span><span class="hljs-number">.4</span>.jar
 | ||
| </code></pre>
 | ||
| <p>After downloading the JAR, run <code>java -jar openapi-generator-cli.jar help</code> to show the usage.</p>
 | ||
| <p>For Mac users, please make sure Java 8 is installed (Tips: run <code>java -version</code> to check the version), and export <code>JAVA_HOME</code> in order to use the supported Java version:</p>
 | ||
| <pre><code class="hljs css language-bash"><span class="hljs-built_in">export</span> JAVA_HOME=`/usr/libexec/java_home -v 1.8`
 | ||
| <span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">${JAVA_HOME}</span>/bin:<span class="hljs-variable">$PATH</span>
 | ||
| </code></pre>
 | ||
| <h2><a class="anchor" aria-hidden="true" id="bash-launcher-script"></a><a href="#bash-launcher-script" aria-hidden="true" class="hash-link"><svg class="hash-link-icon" aria-hidden="true" height="16" version="1.1" viewBox="0 0 16 16" width="16"><path fill-rule="evenodd" d="M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"></path></svg></a>Bash Launcher Script</h2>
 | ||
| <blockquote>
 | ||
| <p><strong>Platform(s)</strong>: Linux, macOS, Windows (variable)</p>
 | ||
| </blockquote>
 | ||
| <p>One downside to manual JAR downloads is that you don't keep up-to-date with the latest released version. We have a Bash launcher script at <a href="https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh">bin/utils/openapi-generator.cli.sh</a> which solves this problem.</p>
 | ||
| <p>To install the launcher script, copy the contents of the script to a location on your path and make the script executable.</p>
 | ||
| <p>An example of setting this up (NOTE: Always evaluate scripts curled from external systems before executing them).</p>
 | ||
| <pre><code class="hljs css language-bash">mkdir -p ~/bin/openapitools
 | ||
| curl https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/bin/utils/openapi-generator-cli.sh > ~/bin/openapitools/openapi-generator-cli
 | ||
| chmod u+x ~/bin/openapitools/openapi-generator-cli
 | ||
| <span class="hljs-built_in">export</span> PATH=<span class="hljs-variable">$PATH</span>:~/bin/openapitools/
 | ||
| </code></pre>
 | ||
| <p>Now, <code>openapi-generator-cli</code> is "installed". On invocation, it will query the GitHub repository for the most recently released version. If this matches the last downloaded jar,
 | ||
| it will execute as normal. If a newer version is found, the script will download the latest release and execute it.</p>
 | ||
| <p>If you need to invoke an older version of the generator, you can define the variable <code>OPENAPI_GENERATOR_VERSION</code> either ad hoc or globally. You can export this variable if you'd like to persist a specific release version.</p>
 | ||
| <p>Examples:</p>
 | ||
| <pre><code class="hljs css language-bash"><span class="hljs-comment"># Execute latest released openapi-generator-cli</span>
 | ||
| openapi-generator-cli version
 | ||
| 
 | ||
| <span class="hljs-comment"># Execute version 3.1.0 for the current invocation, regardless of the latest released version</span>
 | ||
| OPENAPI_GENERATOR_VERSION=3.1.0 openapi-generator-cli version
 | ||
| 
 | ||
| <span class="hljs-comment"># Execute version 3.1.0-SNAPSHOT for the current invocation</span>
 | ||
| OPENAPI_GENERATOR_VERSION=3.1.0-SNAPSHOT openapi-generator-cli version
 | ||
| 
 | ||
| <span class="hljs-comment"># Execute version 3.0.2 for every invocation in the current shell session</span>
 | ||
| <span class="hljs-built_in">export</span> OPENAPI_GENERATOR_VERSION=3.0.2
 | ||
| openapi-generator-cli version <span class="hljs-comment"># is 3.0.2</span>
 | ||
| openapi-generator-cli version <span class="hljs-comment"># is also 3.0.2</span>
 | ||
| 
 | ||
| <span class="hljs-comment"># To "install" a specific version, set the variable in .bashrc/.bash_profile</span>
 | ||
| <span class="hljs-built_in">echo</span> <span class="hljs-string">"export OPENAPI_GENERATOR_VERSION=3.0.2"</span> >> ~/.bashrc
 | ||
| <span class="hljs-built_in">source</span> ~/.bashrc
 | ||
| openapi-generator-cli version <span class="hljs-comment"># is always 3.0.2, unless any of the above overrides are done ad hoc</span>
 | ||
| </code></pre>
 | ||
| </span></div></article></div><div class="docLastUpdate"><em>Last updated on 12/12/2019</em></div><div class="docs-prevnext"><a class="docs-next button" href="/docs/plugins"><span>Plugins</span><span class="arrow-next"> →</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#npm">NPM</a></li><li><a href="#homebrew">Homebrew</a></li><li><a href="#docker">Docker</a></li><li><a href="#jar">JAR</a></li><li><a href="#bash-launcher-script">Bash Launcher Script</a></li></ul></nav></div><footer class="nav-footer" id="footer"><section class="sitemap"><a href="/" class="nav-home"><img src="/img/mono-logo.svg" alt="OpenAPI Generator" width="66" height="58"/></a><div><h5>Docs</h5><a href="/docs/en/customization.html">Customizing Generators</a><a href="/docs/en/integrations.html">Workflow Integrations</a></div><div><h5>Community</h5><a href="/en/users.html">User Showcase</a><a href="http://stackoverflow.com/questions/tagged/openapi-generator" target="_blank" rel="noreferrer noopener">Stack Overflow</a><a href="https://join.slack.com/t/openapi-generator/shared_invite/enQtNzAyNDMyOTU0OTE1LTY5ZDBiNDI5NzI5ZjQ1Y2E5OWVjMjZkYzY1ZGM2MWQ4YWFjMzcyNDY5MGI4NjQxNDBiMTlmZTc5NjY2ZTQ5MGM">Chat Room</a><a href="https://twitter.com/oas_generator" target="_blank" rel="noreferrer noopener">Twitter</a></div><div><h5>More</h5><a href="/blog">Blog</a><a href="https://github.com/OpenAPITools/openapi-generator">GitHub Repo</a><a class="github-button" href="https://github.com/OpenAPITools/openapi-generator" data-icon="octicon-star" data-count-href="/OpenAPITools/openapi-generator/stargazers" data-show-count="true" data-count-aria-label="# stargazers on GitHub" aria-label="Star this project on GitHub">Star</a></div></section><section class="copyright">Copyright © 2019 OpenAPI-Generator Contributors (https://openapi-generator.tech). (Both "OpenAPI Tools" (https://OpenAPITools.org) and "OpenAPI Generator" are not affiliated with OpenAPI Initiative (OAI))</section></footer></div></body></html> |