wing328 7679f9b931 Deploy website
Deploy website version based on 47e262fbb1bea54b7fefd332105691c9af1e420a
2019-01-22 09:40:57 +00:00

84 lines
15 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>Debugging · OpenAPI Generator</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="&lt;h2&gt;&lt;a class=&quot;anchor&quot; aria-hidden=&quot;true&quot; id=&quot;templates&quot;&gt;&lt;/a&gt;&lt;a href=&quot;#templates&quot; aria-hidden=&quot;true&quot; class=&quot;hash-link&quot;&gt;&lt;svg class=&quot;hash-link-icon&quot; aria-hidden=&quot;true&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;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&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Templates&lt;/h2&gt;
"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="Debugging · OpenAPI Generator"/><meta property="og:type" content="website"/><meta property="og:url" content="https://openapi-generator.tech/index.html"/><meta property="og:description" content="&lt;h2&gt;&lt;a class=&quot;anchor&quot; aria-hidden=&quot;true&quot; id=&quot;templates&quot;&gt;&lt;/a&gt;&lt;a href=&quot;#templates&quot; aria-hidden=&quot;true&quot; class=&quot;hash-link&quot;&gt;&lt;svg class=&quot;hash-link-icon&quot; aria-hidden=&quot;true&quot; height=&quot;16&quot; version=&quot;1.1&quot; viewBox=&quot;0 0 16 16&quot; width=&quot;16&quot;&gt;&lt;path fill-rule=&quot;evenodd&quot; d=&quot;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&quot;&gt;&lt;/path&gt;&lt;/svg&gt;&lt;/a&gt;Templates&lt;/h2&gt;
"/><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><link rel="stylesheet" href="/css/main.css"/></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"><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="container docsNavContainer" id="docsNav"><nav class="toc"><div class="toggleNav"><section class="navWrapper wrapper"><div class="navBreadcrumb wrapper"><div class="navToggle" id="navToggler"><i></i></div><h2><i></i><span>Extending</span></h2><div class="tocToggler" id="tocToggler"><i class="icon-toc"></i></div></div><div class="navGroups"><div class="navGroup"><h3 class="navGroupCategoryTitle">Getting Started</h3><ul><li class="navListItem"><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">Extending</h3><ul><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 navListItemActive"><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">Contributing</h3><ul><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">About</h3><ul><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&amp;A</a></li></ul></div><div class="navGroup"><h3 class="navGroupCategoryTitle">Releases</h3><ul><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">API</h3><ul><li class="navListItem"><a class="navItem" href="/docs/generators">Generators List</a></li></ul></div></div></section></div><script>
document.addEventListener('DOMContentLoaded', function() {
createToggler('#navToggler', '#docsNav', 'docsSliderActive');
createToggler('#tocToggler', 'body', 'tocActive');
const headings = document.querySelector('.toc-headings');
headings && headings.addEventListener('click', function(event) {
if (event.target.tagName === 'A') {
document.body.classList.remove('tocActive');
}
}, 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"><div class="wrapper"><div class="post"><header class="postHeader"><h1 class="postHeaderTitle">Debugging</h1></header><article><div><span><h2><a class="anchor" aria-hidden="true" id="templates"></a><a href="#templates" 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>Templates</h2>
<p>Sometimes, you may have issues with variables in your templates. As discussed in the <a href="/docs/templating">templating</a> docs, we offer a variety of system properties for inspecting the models bound to templates.</p>
<dl>
<dt><code>-DdebugOpenAPI</code></dt>
<dd>Prints out the JSON model of the OpenAPI Document, as seen by OpenAPI Generator</dd>
<dt><code>-DdebugModels</code></dt>
<dd>Prints out the JSON model passed to model templates</dd>
<dt><code>-DdebugOperations</code></dt>
<dd>Prints out the JSON model passed to operation (api) templates</dd>
<dt><code>-DdebugSupportingFiles</code></dt>
<dd>Prints out the JSON model passed to supporting files</dd>
</dl>
<p>One or more of these properties can be passed alongside other command line options:</p>
<pre><code class="hljs css language-bash">openapi-generator generate -g go \
-o out \
-i petstore-minimal.yaml \
-DdebugModels \
-DdebugOperations
</code></pre>
<p>Or you can add these to your <code>JAVA_OPTS</code> environment variable (this applies to every invocation of the tool):</p>
<pre><code class="hljs css language-bash"><span class="hljs-built_in">export</span> JAVA_OPTS=<span class="hljs-string">"<span class="hljs-variable">${JAVA_OPTS}</span> -DdebugModels -DdebugOperations"</span>
</code></pre>
<blockquote>
<p>NOTE: Globally available system options like these will apply to all invocations of the generator (CLI and plugins)</p>
</blockquote>
<h2><a class="anchor" aria-hidden="true" id="runtime"></a><a href="#runtime" 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>Runtime</h2>
<p>When you're working with a custom generator, a new generator, or otherwise trying to understand the behavior of the toolset, you may need to attach a remote debugger in order to step through the code.</p>
<p>The steps are shown here for a specific version of the generator, but apply the same if you're working off master or a feature branch.</p>
<ul>
<li>Determine the version of <code>openapi-generator</code> you're using. For the CLI, this is:
<pre><code class="hljs">openapi-generator <span class="hljs-built_in">version</span>
</code></pre></li>
<li>Navigate to the <code>openapi-generator</code> source directory (see <a href="/docs/contribute-building">building</a> docs for obtaining source code and brief introduction).</li>
<li>Checkout the branch/tag for the target version. Branches are not prefixed, but tags are prefixed with a <code>v</code>. For instance if you're using version <code>3.3.0</code>, you will execute:
<pre><code class="hljs">git checkout v3<span class="hljs-number">.3</span><span class="hljs-number">.0</span>
</code></pre></li>
<li>Open the project in your IDE.</li>
<li>Setup your IDE for remote debugging. You'll want to define a port used for connecting the remote debugger. For this example, we'll use <code>5005</code>. See external tutorials for <a href="https://www.jetbrains.com/help/idea/run-debug-configuration-remote-debug.html">IntelliJ</a> and <a href="https://www.ibm.com/developerworks/library/os-eclipse-javadebug/index.html">Eclipse</a></li>
<li>Export the debug configuration, specifying <code>suspend=y</code> so you have time to attach a remote debugger. These are passed as Java system properties, either on command line or as part of the <code>JAVA_OPTS</code> environment variable. This will look like:
<pre><code class="hljs"><span class="hljs-builtin-name">export</span> <span class="hljs-attribute">JAVA_OPTS</span>=<span class="hljs-string">"<span class="hljs-variable">${JAVA_OPTS}</span> -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005"</span>
</code></pre></li>
<li>Execute the generator with your desired options. You should see the application output <em>only</em>
<pre><code class="hljs">Listening <span class="hljs-keyword">for</span> transport dt_socket at <span class="hljs-selector-tag">address</span>: <span class="hljs-number">5005</span>
</code></pre></li>
<li>Set breakpoints in code, and then attach your remote debugger from your IDE (see above). The generator will automatically unblock once the remote debugger is attached. You can now step through the code.</li>
</ul>
</span></div></article></div><div class="docLastUpdate"><em>Last updated on 2019-1-18</em></div><div class="docs-prevnext"><a class="docs-prev button" href="/docs/customization"><span class="arrow-prev"></span><span>Customization</span></a><a class="docs-next button" href="/docs/integrations"><span>Workflow Integrations</span><span class="arrow-next"></span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#templates">Templates</a></li><li><a href="#runtime">Runtime</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://gitter.im/OpenAPITools/openapi-generator">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 &quot;OpenAPI Tools&quot; (https://OpenAPITools.org) and &quot;OpenAPI Generator&quot; are not affiliated with OpenAPI Initiative (OAI))</section></footer></div></body></html>