cloudendpoints/endpoints-python

During generation of client API (Java / Android): Wrong "True" value

Closed this issue · 5 comments

/**
   * Convenience method that returns only {@link Boolean#TRUE} or {@link Boolean#FALSE}.
   *
   * <p>
   * Boolean properties can have four possible values:
   * {@code null}, {@link com.google.api.client.util.Data#NULL_BOOLEAN}, {@link Boolean#TRUE}
   * or {@link Boolean#FALSE}.
   * </p>
   *
   * <p>
   * This method returns {@link Boolean#TRUE} if the default of the property is {@link Boolean#TRUE}
   * and it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
   * {@link Boolean#FALSE} is returned if the default of the property is {@link Boolean#FALSE} and
   * it is {@code null} or {@link com.google.api.client.util.Data#NULL_BOOLEAN}.
   * </p>
   *
   * <p>
   *
   * </p>
   */
  public boolean isSomething() {
    if (isSomething == null || isSomething == com.google.api.client.util.Data.NULL_BOOLEAN) {
      return True;
    }
    return isSomething;
  }

In above-generated code, in Java / Android, the function return "True" instead of java's "true" (small "t").

it generate only when I set "default=True" or "default=False".

class X(messages.Message):
    is_something = messages.BooleanField(19)

Any update on this?

Not yet; it's in my list of things to investigate.

discovery docs are expected to encode defaults as they would be found in protocol buffer specifications. For booleans, this means "true" and "false".

A new version with this fix will be released after the Thanksgiving holiday.

Frameworks version 4.8.0 has been released, which includes a fix for this issue.