Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Android/Java] Ambiguous Object #4279

Closed
tgraupmann opened this issue Nov 29, 2016 · 4 comments

Comments

@tgraupmann
Copy link

commented Nov 29, 2016

Object has a namespace collision in JsonUtil.java

  public static String serialize(Object obj){
    return getGson().toJson(obj);
  }
Description

Need to generate the namespace with Object to avoid collision.

Swagger-codegen version

Using: http://editor.swagger.io/#/

Swagger declaration file content or url

Loading from URL:
https://polling.arena.razerzone.com/swagger/docs/v1

Exporting to Android.

Importing to Android Studio.

Gradle reports the ambiguous Object error.

Steps to reproduce
  1. Go to http://editor.swagger.io/

  2. File Import URL:
    https://polling.arena.razerzone.com/swagger/docs/v1

  3. Generate Client Android

  4. Unpack zip file

  5. Import as new project in Android Studio

  6. See the gradle compile error

Related issues

#4278

Suggest a Fix
  public static String serialize(java.lang.Object obj){
    return getGson().toJson(obj);
  }
  public ResponseOutputModelString authenticateGetRazerIdAccessTokenProfile (RazerIdTokenLoginPostModel tokenLoginModel) throws TimeoutException, ExecutionException, InterruptedException, ApiException {
     java.lang.Object postBody = tokenLoginModel;
  @Override
  public boolean equals(java.lang.Object o) {
@tgraupmann

This comment has been minimized.

Copy link
Author

commented Nov 30, 2016

I made a Windows.Forms app to automate syntax fixes as a workaround. The ideal fix would be to fix the template. https://github.com/tgraupmann/SwaggerAndroidClientFixer

@tgraupmann tgraupmann changed the title [Android/Java] Ambiguous Object [Android/Java] Ambiguous Object [Client: Android] Nov 30, 2016

@tgraupmann tgraupmann changed the title [Android/Java] Ambiguous Object [Client: Android] [Android] Ambiguous Object Nov 30, 2016

@tgraupmann tgraupmann changed the title [Android] Ambiguous Object [Android/Java] Ambiguous Object Nov 30, 2016

@tgraupmann

This comment has been minimized.

Copy link
Author

commented Nov 30, 2016

Trying to add Client: Android label...

@wing328

This comment has been minimized.

Copy link
Contributor

commented Dec 1, 2016

@tgraupmann using namespace is one way to resolve the issue. I've instead added "Object" as a keyword for the time being so the model will be renamed to "ModelObject" instead: #4305

@wing328 wing328 added this to the v2.2.2 milestone Dec 1, 2016

@wing328 wing328 added the Issue: Bug label Dec 1, 2016

@wing328

This comment has been minimized.

Copy link
Contributor

commented Dec 1, 2016

Closed via #4305

Please pull the latest master to give it a try.

@wing328 wing328 closed this Dec 1, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.