sendinblue / APIv3-java-library

SendinBlue's API v3 Java Library
MIT License
41 stars 12 forks source link

Non-typed return values for a few of your api calls #41

Open rasharab opened 2 years ago

rasharab commented 2 years ago

i.e.

public class GetFolders {
  @SerializedName("folders")
  private List<Object> folders = null;

  public GetFolders folders(List<Object> folders) {
    this.folders = folders;
    return this;
  }

i.e.

public class GetFolderLists {
  @SerializedName("lists")
  private List<Object> lists = null;

  public GetFolderLists lists(List<Object> lists) {
    this.lists = lists;
    return this;
  }

Your openspec apis also are not providing any properly types response objects for GetFolders, GetLists etc.

Is there a reason for this?

Kool-Hussain commented 1 year ago

Hi @rasharab, This is an auto-generated code using swagger-codegen. For better documentation and readability you can always refer to our API documentation given here: https://developers.sendinblue.com/reference/getfolders-1 https://developers.sendinblue.com/reference/getfolderlists-1 Thanks!

rasharab commented 1 year ago

We use openapi code generation tools as well and outside of possibly how you've typed the aforementioned fields in your spec, it's surprising that it's being translated to the Object type.

The larger point is that it makes end users lives more difficult as we're dealing with non-typed objects.

oxygenecore commented 2 months ago

SDK which does not allow you to use it, somewhat kills the purpose of having SDK in the first place. What is the suggested solution? Should we cast to internal Gson classes and freeze the Gson dependency version in the build tool?

oxygenecore commented 2 months ago

Currently, I hope that the model classes are still properly generated according to actual schema, and use this ad-hoc method to convert each object to the "proper" type (which I only assume from class name): image