mirror of
https://github.com/OpenAPITools/openapi-generator.git
synced 2025-05-12 12:40:53 +00:00
109 lines
27 KiB
HTML
109 lines
27 KiB
HTML
<!DOCTYPE html><html lang="en"><head><meta charSet="utf-8"/><meta http-equiv="X-UA-Compatible" content="IE=edge"/><title>FAQ: Generators · OpenAPI Generator</title><meta name="viewport" content="width=device-width"/><meta name="generator" content="Docusaurus"/><meta name="description" content="<h3><a class="anchor" aria-hidden="true" id="what-are-some-server-generator-use-cases"></a><a href="#what-are-some-server-generator-use-cases" 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>What are some server generator use cases?</h3>
|
||
"/><meta name="docsearch:language" content="en"/><meta property="og:title" content="FAQ: Generators · OpenAPI Generator"/><meta property="og:type" content="website"/><meta property="og:url" content="https://openapi-generator.tech/index.html"/><meta property="og:description" content="<h3><a class="anchor" aria-hidden="true" id="what-are-some-server-generator-use-cases"></a><a href="#what-are-some-server-generator-use-cases" 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>What are some server generator use cases?</h3>
|
||
"/><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=""><a href="/docs/installation" target="_self">Get Started</a></li><li class=""><a href="/docs/generators" target="_self">Generators</a></li><li class=""><a href="/docs/roadmap" target="_self">Roadmap</a></li><li class=""><a href="/team" target="_self">Team</a></li><li class="siteNavGroupActive"><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>FAQ</span></h2><div class="tocToggler" id="tocToggler"><i class="icon-toc"></i></div></div><div class="navGroups"><div class="navGroup"><h3 class="navGroupCategoryTitle">FAQ</h3><ul><li class="navListItem"><a class="navItem" href="/docs/faq">FAQ: General</a></li><li class="navListItem"><a class="navItem" href="/docs/faq-extending">FAQ: Extending</a></li><li class="navListItem"><a class="navItem" href="/docs/faq-contributing">FAQ: Contributing</a></li><li class="navListItem navListItemActive"><a class="navItem" href="/docs/faq-generators">FAQ: Generators</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">FAQ: Generators</h1></header><article><div><span><h3><a class="anchor" aria-hidden="true" id="what-are-some-server-generator-use-cases"></a><a href="#what-are-some-server-generator-use-cases" 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>What are some server generator use cases?</h3>
|
||
<p>We have around 40+ server generators, with more added regularly. Some of these include Spring in your choice of Java or Kotlin, the Finch and Scalatra frameworks using Scala, and C# generators for NancyFX and WebAPI (to name only a few).</p>
|
||
<p>Besides generating the server code as a starting point to implement the API backend, here are some use cases of the server generators:</p>
|
||
<ul>
|
||
<li><strong>prototyping</strong> - one can generate the server code and have a functional API backend very quickly to try different things or features.</li>
|
||
<li><strong>mocking</strong> - easily provide an API backend for mocking based on the examples field defined in the response object.</li>
|
||
<li><strong>migration</strong> - let's say one wants to migrate an API backend from Ruby on Rails to Java Spring. The server generator can save a lot of time in implementing and verify each endpoint in the new API backend.</li>
|
||
<li><strong>evaluating</strong> - when you want to try a new language or framework, and a typical "Hello, World" is too trivial.</li>
|
||
</ul>
|
||
<h2><a class="anchor" aria-hidden="true" id="java"></a><a href="#java" 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>Java</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="the-api-client-has-ssl-errors-due-to-an-invalid-certificate-is-there-a-way-to-bypass-that"></a><a href="#the-api-client-has-ssl-errors-due-to-an-invalid-certificate-is-there-a-way-to-bypass-that" 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>The API client has SSL errors due to an invalid certificate. Is there a way to bypass that?</h3>
|
||
<p>Yes, please refer to <a href="http://stackoverflow.com/a/6055903/677735">http://stackoverflow.com/a/6055903/677735</a></p>
|
||
<h3><a class="anchor" aria-hidden="true" id="how-can-i-customize-the-feign-client-templates"></a><a href="#how-can-i-customize-the-feign-client-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>How can I customize the Feign client templates?</h3>
|
||
<p>You will need to provide customized files in <code>Java/libraries/feign</code> under the resources folder and pass the location via the <code>-t</code> option.</p>
|
||
<p>In your Gradle build script, please add the following (example):</p>
|
||
<pre><code class="hljs">config.templateDir = <span class="hljs-symbol">'src</span>/openapi-generator-templates/Java/libraries/feign
|
||
</code></pre>
|
||
<h2><a class="anchor" aria-hidden="true" id="android"></a><a href="#android" 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>Android</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="how-can-i-generate-an-android-sdk"></a><a href="#how-can-i-generate-an-android-sdk" 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>How can I generate an Android SDK?</h3>
|
||
<p><strong>The Java SDK is also compatible with Android.</strong></p>
|
||
<p>[RECOMMENDED] To generate the Java SDK with <code>okhttp</code> and <code>gson</code> libraries, run the following:</p>
|
||
<pre><code class="hljs">mvn clean <span class="hljs-keyword">package</span>
|
||
java -jar modules<span class="hljs-regexp">/openapi-generator-cli/</span>target<span class="hljs-regexp">/openapi-generator-cli.jar generate \
|
||
-i https:/</span><span class="hljs-regexp">/raw.githubusercontent.com/</span>OpenAPITools<span class="hljs-regexp">/openapi-generator/m</span>aster<span class="hljs-regexp">/modules/</span>openapi-generator<span class="hljs-regexp">/src/</span>test<span class="hljs-regexp">/resources/</span><span class="hljs-number">2</span>_0<span class="hljs-regexp">/petstore.json \
|
||
-l java --library=okhttp-gson \
|
||
-D hideGenerationTimestamp=true \
|
||
-o /</span>var<span class="hljs-regexp">/tmp/</span>java<span class="hljs-regexp">/okhttp-gson/</span>
|
||
</code></pre>
|
||
<p>You can also generate the Java SDK with other HTTP libraries by replacing <code>okhttp-gson</code> with <code>retrofit</code> for example. For a list of support libraries, please run</p>
|
||
<pre><code class="hljs">java -jar modules/openapi-generator-<span class="hljs-keyword">cli</span>/target/openapi-generator-<span class="hljs-keyword">cli</span>.jar config-<span class="hljs-keyword">help</span> -<span class="hljs-keyword">l</span> java
|
||
</code></pre>
|
||
<p>To generate the Android SDK with <a href="https://github.com/mcxiaoke/android-volley"><code>volley</code></a>, please run</p>
|
||
<pre><code class="hljs">mvn clean <span class="hljs-keyword">package</span>
|
||
java -jar modules<span class="hljs-regexp">/openapi-generator-cli/</span>target<span class="hljs-regexp">/openapi-generator-cli.jar generate \
|
||
-i https:/</span><span class="hljs-regexp">/raw.githubusercontent.com/</span>OpenAPITools<span class="hljs-regexp">/openapi-generator/m</span>aster<span class="hljs-regexp">/modules/</span>openapi-generator<span class="hljs-regexp">/src/</span>test<span class="hljs-regexp">/resources/</span><span class="hljs-number">2</span>_0<span class="hljs-regexp">/petstore.json \
|
||
-l android --library=volley \
|
||
-o /</span>var<span class="hljs-regexp">/tmp/</span>android<span class="hljs-regexp">/volley/</span>
|
||
</code></pre>
|
||
<p>We do <strong>not</strong> recommend using the default HTTP library (Apache HttpClient) with <code>android</code> as it's not actively maintained.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="c-sharp"></a><a href="#c-sharp" 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>C-Sharp</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="how-do-i-fix-csc-warning-cs2002-in-xamarin"></a><a href="#how-do-i-fix-csc-warning-cs2002-in-xamarin" 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>How do I fix <code>CSC: warning CS2002</code> in Xamarin?</h3>
|
||
<p>The full warning might look like this: <code>CSC: warning CS2002: Source file 'Api/FakeApi.cs' specified multiple times</code></p>
|
||
<p>The warning has no impact on the build process so you should be able to build the solution without issue. The warning should be addressed in the upcoming stable release of Xamarin.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="objective-c"></a><a href="#objective-c" 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>Objective-C</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="how-do-i-run-integration-test-with-petstore-objc-api-client"></a><a href="#how-do-i-run-integration-test-with-petstore-objc-api-client" 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>How do I run integration test with Petstore ObjC API client?</h3>
|
||
<p>Here are the steps:</p>
|
||
<pre><code class="hljs">git clone https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/openapitools/</span>openapi-generator.git
|
||
cd openapi-generator<span class="hljs-regexp">/samples/</span>client<span class="hljs-regexp">/petstore/</span>objc<span class="hljs-regexp">/default/</span>OpenAPIClientTests
|
||
mvn integration-test
|
||
</code></pre>
|
||
<p>Besides <code>default</code> (folder) ObjC API client, there's also <code>core-data</code> for another ObjC API client with <a href="https://en.wikipedia.org/wiki/Core_Data">Core Data support</a>.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="swift"></a><a href="#swift" 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>Swift</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="how-do-i-run-integration-test-with-petstore-swift-api-client"></a><a href="#how-do-i-run-integration-test-with-petstore-swift-api-client" 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>How do I run integration test with Petstore Swift API client?</h3>
|
||
<p>Here are the steps:</p>
|
||
<pre><code class="hljs">git clone https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/openapitools/</span>openapi-generator.git
|
||
cd openapi-generator<span class="hljs-regexp">/samples/</span>client<span class="hljs-regexp">/petstore/</span>swift<span class="hljs-regexp">/default/</span>OpenAPIClientTests
|
||
mvn integration-test
|
||
</code></pre>
|
||
<p>Besides <code>default</code> (folder), there's another folder <code>promisekit</code> for Swift API client with <a href="https://github.com/mxcl/PromiseKit">PromiseKit support</a></p>
|
||
<pre><code class="hljs">git clone https:<span class="hljs-regexp">//gi</span>thub.com<span class="hljs-regexp">/openapitools/</span>openapi-generator.git
|
||
cd openapi-generator<span class="hljs-regexp">/samples/</span>client<span class="hljs-regexp">/petstore/</span>swift<span class="hljs-regexp">/promisekit/</span>OpenAPIClientTests
|
||
mvn integration-test
|
||
</code></pre>
|
||
<h3><a class="anchor" aria-hidden="true" id="is-swift-2x-generator-still-actively-maintained"></a><a href="#is-swift-2x-generator-still-actively-maintained" 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>Is Swift (2.x) generator still actively maintained?</h3>
|
||
<p>No, please use <code>swift3</code> or <code>swift4</code> generator instead as we want to focus on Swift 3.x, 4.x.</p>
|
||
<h2><a class="anchor" aria-hidden="true" id="typescript"></a><a href="#typescript" 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>TypeScript</h2>
|
||
<h3><a class="anchor" aria-hidden="true" id="the-json-response-fails-to-deserialize-due-to-change-in-variable-naming-snake-case-to-camelcase-is-there-any-way-to-keep-the-original-naming"></a><a href="#the-json-response-fails-to-deserialize-due-to-change-in-variable-naming-snake-case-to-camelcase-is-there-any-way-to-keep-the-original-naming" 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>The JSON response fails to deserialize due to change in variable naming (snake_case to camelCase). Is there any way to keep the original naming?</h3>
|
||
<p>Yes, please use the following option when generating TypeScript clients:</p>
|
||
<pre><code class="hljs"> modelPropertyNaming
|
||
Naming convention <span class="hljs-keyword">for</span> the <span class="hljs-keyword">property</span>: <span class="hljs-string">'camelCase'</span>, <span class="hljs-string">'PascalCase'</span>, <span class="hljs-string">'snake_case'</span> <span class="hljs-keyword">and</span> <span class="hljs-string">'original'</span>, which keeps the original <span class="hljs-keyword">name</span> (<span class="hljs-keyword">Default</span>: camelCase)
|
||
</code></pre>
|
||
</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/faq-contributing"><span class="arrow-prev">← </span><span>FAQ: Contributing</span></a></div></div></div><nav class="onPageNav"><ul class="toc-headings"><li><a href="#java">Java</a><ul class="toc-headings"><li><a href="#the-api-client-has-ssl-errors-due-to-an-invalid-certificate-is-there-a-way-to-bypass-that">The API client has SSL errors due to an invalid certificate. Is there a way to bypass that?</a></li><li><a href="#how-can-i-customize-the-feign-client-templates">How can I customize the Feign client templates?</a></li></ul></li><li><a href="#android">Android</a><ul class="toc-headings"><li><a href="#how-can-i-generate-an-android-sdk">How can I generate an Android SDK?</a></li></ul></li><li><a href="#c-sharp">C-Sharp</a><ul class="toc-headings"><li><a href="#how-do-i-fix-csc-warning-cs2002-in-xamarin">How do I fix <code>CSC: warning CS2002</code> in Xamarin?</a></li></ul></li><li><a href="#objective-c">Objective-C</a><ul class="toc-headings"><li><a href="#how-do-i-run-integration-test-with-petstore-objc-api-client">How do I run integration test with Petstore ObjC API client?</a></li></ul></li><li><a href="#swift">Swift</a><ul class="toc-headings"><li><a href="#how-do-i-run-integration-test-with-petstore-swift-api-client">How do I run integration test with Petstore Swift API client?</a></li><li><a href="#is-swift-2x-generator-still-actively-maintained">Is Swift (2.x) generator still actively maintained?</a></li></ul></li><li><a href="#typescript">TypeScript</a><ul class="toc-headings"><li><a href="#the-json-response-fails-to-deserialize-due-to-change-in-variable-naming-snake-case-to-camelcase-is-there-any-way-to-keep-the-original-naming">The JSON response fails to deserialize due to change in variable naming (snake_case to camelCase). Is there any way to keep the original naming?</a></li></ul></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 "OpenAPI Tools" (https://OpenAPITools.org) and "OpenAPI Generator" are not affiliated with OpenAPI Initiative (OAI))</section></footer></div></body></html> |