Swagger-codegen: [Android] Android Client SDK build fail when no "definitions" in OpenAPI specification

Created on 23 Nov 2017  路  3Comments  路  Source: swagger-api/swagger-codegen

Description

The "DefaultApi.java" class and the "JsonUtil.java" class of an Android Client SDK generated from a swagger definition without a "definitions" section, has an import statement
"import org.wso2.client.model..*".<br /> When generating an Android Client SDK from a swagger definition without a "definitions" section, the package "io.swagger.client.model" does not get generated. Hence a compilation error occurs when building the project.<br /> If the swagger definition does have a "definitions" section, then this issue doesn't arise!</p> <h5>Swagger-codegen version</h5> <p>2.2.2 , 2.2.3</p> <p>Below is a screenshot of the Android Client SDK<br /> <img src="https://user-images.githubusercontent.com/16064696/33161488-d418bd16-d049-11e7-9963-fbd24fa45c05.png" alt="screenshot from 2017-11-23 12-27-06" /></p> </div> <div> <span class="badge badge-primary">Android</span> <span class="badge badge-primary">Bug</span> <div class="float-right"> <a class="text-muted" href="https://www.github.com/swagger-api/swagger-codegen/issues/7033" rel="nofollow noreferrer" target="_blank" onclick="dataLayer.push({'event': 'GAEvent', 'eventCategory': 'click', 'eventAction': 'source_bottom', 'eventLabel': 'Source Bottom', 'eventValue': undefined});">Source</a> </div> </div> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/16064696?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt=" picture"> <strong>vlgunarathne</strong> </div> <div class="col text-right"> </div> </div> </div> </div> </div> <div class="col-12"> <div id="ph-above-best-comment"> </div> </div> <div class="col-12"> <div class="mb-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="9295564578" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="col-12 d-flex align-items-center mb-4"> <h2>All 3 comments</h2> </div> <div class="col-12"> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@vlgunarathne</strong> as a workaround, I wonder if you can try generating the Java API client, which is also compatible with Android: <a rel="nofollow noopener" target="_blank" href="https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how">https://github.com/swagger-api/swagger-codegen/wiki/FAQ#how</a>-can-i-generate-an-android-sdk</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/934260?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="wing328 picture"> <strong>wing328</strong> <span class="text-muted ml-1">on 23 Nov 2017</span> </div> <div class="col text-right"> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@wing328</strong>, Got it working with the Java API client. Thanks for the workaround!</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/16064696?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="vlgunarathne picture"> <strong>vlgunarathne</strong> <span class="text-muted ml-1">on 23 Nov 2017</span> </div> <div class="col text-right"> 👍<span class="ml-2 mr-3">1</span> </div> </div> </div> </div> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown"> <p><strong>@vlgunarathne</strong> glad to hear that. Closing this one as I remember there's another issue to track something similar.</p> </div> <div class="card-footer"> <div class="row"> <div class="col"> <img src="https://avatars2.githubusercontent.com/u/934260?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="wing328 picture"> <strong>wing328</strong> <span class="text-muted ml-1">on 23 Nov 2017</span> </div> <div class="col text-right"> 👍<span class="ml-2 mr-3">1</span> </div> </div> </div> </div> </div> <div class="col-12"> <div class="card card-custom mb-4"> <div class="card-body pt-3 pb-3 markdown text-center helpful"> <div class="title">Was this page helpful?</div> <div class="mt-1" onMouseLeave="rating(276279795, 0);"> <i class="fas fa-star inactive" id="star-1" onMouseOver="rating(276279795, 1);" onclick="rate(276279795, 1);"></i> <i class="fas fa-star inactive" id="star-2" onMouseOver="rating(276279795, 2);" onclick="rate(276279795, 2);"></i> <i class="fas fa-star inactive" id="star-3" onMouseOver="rating(276279795, 3);" onclick="rate(276279795, 3);"></i> <i class="fas fa-star inactive" id="star-4" onMouseOver="rating(276279795, 4);" onclick="rate(276279795, 4);"></i> <i class="fas fa-star inactive" id="star-5" onMouseOver="rating(276279795, 5);" onclick="rate(276279795, 5);"></i> </div> <div class="description text-small"><span id="rating-val">0</span> / 5 - <span id="rating-count">0</span> ratings</div> </div> </div> <div class="mb-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3452512275" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> </div> <div class="col-12 col-lg-4"> <div id="ph-above-related"></div> <div class="card card-custom issue-box"> <div class="card-body pt-3 pb-5"> <h2 class="mb-4">Related issues</h2> <div> <strong> <a href="/swagger-codegen/276510151/retrofit2-codegen-depends-on-a-corrupted-version-of-oauth2">retrofit2 codegen depends on a corrupted version of oauth2 client</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars0.githubusercontent.com/u/5998305?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="justwy picture"> <strong class="pr-1" dir="ltr">justwy</strong>  路  <span class="px-1" dir="ltr">3</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/swagger-codegen/260407416/javascript-how-do-i-set-auth-headers-for-all-some-requests">[JavaScript] How do I set auth headers for all/some requests?</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/1261477?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="dganoff picture"> <strong class="pr-1" dir="ltr">dganoff</strong>  路  <span class="px-1" dir="ltr">3</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/swagger-codegen/241195561/timeout-functioanlity">timeout functioanlity</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars1.githubusercontent.com/u/6088193?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="mn288 picture"> <strong class="pr-1" dir="ltr">mn288</strong>  路  <span class="px-1" dir="ltr">3</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/swagger-codegen/240709987/generated-python-code-does-not-take-into-account-config-json">Generated python code does not take into account config.json?</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars0.githubusercontent.com/u/1553783?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="edwinevans picture"> <strong class="pr-1" dir="ltr">edwinevans</strong>  路  <span class="px-1" dir="ltr">3</span><span>Comments</span> </div> <hr /> <div> <strong> <a href="/swagger-codegen/222668399/python-better-json-serialization-and-marshaling">[Python] Better JSON Serialization and Marshaling</a> </strong> </div> <div class="text-muted text-small mt-2"> <img src="https://avatars2.githubusercontent.com/u/934260?v=4&s=40" style="width:20px; height:20px;" class="mr-2 rounded float-left" alt="wing328 picture"> <strong class="pr-1" dir="ltr">wing328</strong>  路  <span class="px-1" dir="ltr">3</span><span>Comments</span> </div> </div> </div> <div class="sticky-top pt-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3919948963" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <div id="ph-below-related-2" class="mt-4"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="3919948963" data-ad-format="auto" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> </div> <div class="col-12 col-lg-4"> </div> </div> <div class="skyscraper-container"> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-3835332123789605" data-ad-slot="7879185320" data-ad-format="vertical" data-full-width-responsive="true"></ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> </div> </div> <div class="mt-5 spacer"></div> <footer class="mt-5 pb-2 py-4 text-center mt-auto"> <div class="container"> <a class="navbar-brand logo mr-5" href="/"> <img src="/assets/img/logo.svg" width="40" height="40" alt="bleepingcoder logo"> bleeping<strong>coder</strong> </a> <div class="mt-4"> bleepingcoder.com uses publicly licensed GitHub information to provide developers around the world with solutions to their problems. We are not affiliated with GitHub, Inc. or with any developers who use GitHub for their projects. We do not host any of the videos or images on our servers. All rights belong to their respective owners. </div> <div> Source for this page: <a href="https://www.github.com/swagger-api/swagger-codegen/issues/7033" rel="nofollow noreferrer" target="_blank">Source</a> </div> </div> <hr class="mb-5 mt-5"> <div class="container"> <div class="row"> <div class="col-sm-4 col-lg mb-sm-0 mb-5"> <strong>Popular programming languages</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/python" dir="ltr">Python</a> </li> <li class="mb-2"> <a href="/javascript" dir="ltr">JavaScript</a> </li> <li class="mb-2"> <a href="/typescript" dir="ltr">TypeScript</a> </li> <li class="mb-2"> <a href="/cpp" dir="ltr">C++</a> </li> <li class="mb-2"> <a href="/csharp" dir="ltr">C#</a> </li> </ul> </div> <div class="col-sm-4 col-lg mb-sm-0 mb-5"> <strong>Popular GitHub projects</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/microsoft/vscode" dir="ltr">vscode</a> </li> <li class="mb-2"> <a href="/numpy/numpy" dir="ltr">numpy</a> </li> <li class="mb-2"> <a href="/ant-design/ant-design" dir="ltr">ant-design</a> </li> <li class="mb-2"> <a href="/mui-org/material-ui" dir="ltr">material-ui</a> </li> <li class="mb-2"> <a href="/vercel/next-js" dir="ltr">next.js</a> </li> </ul> </div> <div class="col-sm-4 col-lg mb-0"> <strong>More GitHub projects</strong> <ul class="list-unstyled mb-0 mt-2"> <li class="mb-2"> <a href="/rust-lang/rust" dir="ltr">rust</a> </li> <li class="mb-2"> <a href="/moment/moment" dir="ltr">moment</a> </li> <li class="mb-2"> <a href="/yarnpkg/yarn" dir="ltr">yarn</a> </li> <li class="mb-2"> <a href="/mozilla/pdf-js" dir="ltr">pdf.js</a> </li> <li class="mb-2"> <a href="/JuliaLang/julia" dir="ltr">julia</a> </li> </ul> </div> </div> </div> <hr class="mb-5 mt-5"> <div class="container text-muted"> 漏 2026 bleepingcoder.com - <a href="/bleeps" rel="nofollow">Contact</a><br /> By using our site, you acknowledge that you have read and understand our <a href="/cookies" rel="nofollow">Cookie Policy</a> and <a href="/privacy" rel="nofollow">Privacy Policy</a>. </div> </footer> <script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha256-4+XzXVhsDmqanXGHaHvgh1gMQKX40OUvDEBTu8JcmNs=" crossorigin="anonymous"></script> <script async src="https://cdn.jsdelivr.net/npm/popper.js@1.16.0/dist/umd/popper.min.js" integrity="sha384-Q6E9RHvbIyZFJoft+2mJbHaEWldlvI9IOYy5n3zV9zzTtmI3UksdQRVvoxMfooAo" crossorigin="anonymous"></script> <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js" integrity="sha384-wfSDF2E50Y2D1uUdj0O3uMBJnjuUD4Ih7YwaYd1iqfktj0Uod8GCExl3Og8ifwB6" crossorigin="anonymous"></script> <!--<script defer type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-5fb2db66acbd74b2"></script>--> <script type="text/javascript" src="/assets/js/main.js"></script> <script src="https://cdn.jsdelivr.net/gh/google/code-prettify@master/loader/run_prettify.js"></script></body> </html>