swagger-api / swagger-api/swagger-codegen

[JAVA] Generate Model Type org.joda.time.* For Variables

Open
#6,404 6 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Description

I am getting following code generated inside the model:
Here the property example:

@JsonProperty("commit_time")
  private org.joda.time.* commitTime = null;

Another example:

public CatalogObjectMetadata commitTime(org.joda.time.* commitTime) {
    this.commitTime = commitTime;
    return this;
  }
Swagger-codegen version

I used current master and v2.2.3 tag to test the code generation.

Swagger declaration file content or url

Please find the gist here: https://gist.github.com/anonymous/95b166a38734af9accd944d8b81b0c2f

Command line used for generation
Steps to reproduce

java -jar modules/swagger-codegen-cli/target/swagger-codegen-cli.jar generate -l java --library resteasy -Djava8=true -DgroupId=group.id.name -DartifactId=swagger-client

Related issues/PRs

I found a few issue searching for org.joda.time.* which address similar problems, but always as imports not as the type of a variable.

[EDIT]: Works with the online generator. Maybe related to this?: https://github.com/swagger-api/swagger-codegen/issues/6379

Suggest a fix/enhancement

Maybe I am just using the generator wrong. But using org.joda.time.* as a type looks a bit fishy.

Thank you.

Cheers,
Tobias

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

Start by reproducing the Java generation command with the linked Swagger declaration and the resteasy library, then compare the generated model and accessor types with the online generator output. Review the Java generator's type-mapping or template entry points related to issue 6379; done means the generated variables and method parameters no longer use org.joda.time.* as a type.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.