cloudendpoints / endpoints-python

A Python framework for building RESTful APIs on Google App Engine
Apache License 2.0
51 stars 17 forks source link

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

Closed zonito closed 5 years ago

zonito commented 5 years ago
/**
   * 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)
zonito commented 5 years ago

Any update on this?

inklesspen commented 5 years ago

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

inklesspen commented 5 years ago

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

inklesspen commented 5 years ago

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

inklesspen commented 5 years ago

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