swagger-api / swagger-api/swagger-codegen

[JAVA okhttp-gson; target=Android] Remove joda-time dependency for Android

Open
#5,282 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Java help wanted Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Android usage for generated client is completely wrong. It`s have Java libraries like joda-time included for Android its have completely different version of libraries like:
https://github.com/dlew/joda-time-android

This is the dependency library generated in client:

dependencies {
    compile 'io.swagger:swagger-annotations:1.5.8'
    compile 'com.squareup.okhttp:okhttp:2.7.5'
    compile 'com.squareup.okhttp:logging-interceptor:2.7.5'
    compile 'com.google.code.gson:gson:2.6.2'
    compile 'joda-time:joda-time:2.9.3'
    testCompile 'junit:junit:4.12'
}

Warning: org.joda.time.DateMidnight: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTime: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.FromString
Warning: org.joda.time.DateTimeZone: can't find referenced class org.joda.convert.ToString
....
FAILURE: Build failed with an exception.

  • What went wrong:
    Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease'.
    Job failed, see logs for details

If I set 'dateLibrary' : 'java8' joda time is replaced with Java8 time package. But my android project is java 1.7.
What about to separate Android templates from Java (like Volley)?

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

The issue identifies the generated client's Gradle dependency block and the dateLibrary setting; start by locating the Java and Android client templates that emit these dependencies. Verify the generated Android client on Java 7, and consider the work complete when it no longer requires the incompatible joda-time setup and its release build succeeds.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
build-system, mobile
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.