swagger-api / swagger-api/swagger-codegen

[Android] Generated code does not compile when using enums in inherited models

Open
#2,340 1 comment 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Client: Android Feature: Composition / Inheritance Issue: Bug
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

Repro:

cd /tmp;
mvn org.apache.maven.plugins:maven-dependency-plugin:2.8:get -DrepoUrl=https://oss.sonatype.org/content/repositories/snapshots -Dartifact=io.swagger:swagger-codegen-cli:2.1.6-SNAPSHOT -Ddest=swagger-codegen-cli.jar;
java -jar swagger-codegen-cli.jar generate -i https://gist.githubusercontent.com/who/2ad48a523ce91b646ba7/raw/e9cda73c4bd523fa04bfb59484d6fbfebf75baa2/repro_1051.json -l android -o output;
cd output;
mvn test;

Resulting error:

[ERROR] /tmp/output/src/main/java/io/swagger/client/model/SubObject.java:[35,23] error: getThingType() in SubObject cannot override getThingType() in SuperObject

This is the same issue that was fixed in the Java codegen also - see PR https://github.com/swagger-api/swagger-codegen/pull/1051 and issue https://github.com/swagger-api/swagger-codegen/issues/1050

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

Run the provided Maven generation commands with the linked gist, then inspect the generated src/main/java/io/swagger/client/model/SubObject.java and SuperObject.java. Compare the Android generator with the Java codegen fix in PR #1051; done means the generated Android project passes mvn test without the getThingType() override error.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.