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

[Spring] Duplicate "is" in boolean getter method names #91

Closed
atgabe opened this issue Jun 8, 2018 · 1 comment
Closed

[Spring] Duplicate "is" in boolean getter method names #91

atgabe opened this issue Jun 8, 2018 · 1 comment

Comments

@atgabe
Copy link
Contributor

atgabe commented Jun 8, 2018

When running codegen on schemas using the Spring language, boolean getter method names contain the "is" prefix twice.

For example, this model:

Example:
      type: object
      properties:
        myprop:
          type: boolean
          default: True

Will generate this class:

public class Example   {

  @JsonProperty("myprop")
  private Boolean myprop = true;

  public Example myprop(Boolean myprop) {
    this.myprop = myprop;
    return this;
  }

  /**
   * Get myprop
   * @return myprop
  **/
 
  @ApiModelProperty(value = "")
  public Boolean isisMyprop() {
    return myprop;
  }

  public void setMyprop(Boolean myprop) {
    this.myprop = myprop;
  }

  @Override
  public boolean equals(java.lang.Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    Example example = (Example) o;
    return Objects.equals(this.myprop, example.myprop);
  }

  @Override
  public int hashCode() {
    return Objects.hash(myprop);
  }

  @Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    sb.append("class Example {\n");
    
    sb.append("    myprop: ").append(toIndentedString(myprop)).append("\n");
    sb.append("}");
    return sb.toString();
  }

  /**
   * Convert the given object to string with each line indented by 4 spaces
   * (except the first line).
   */
  private String toIndentedString(java.lang.Object o) {
    if (o == null) {
      return "null";
    }
    return o.toString().replace("\n", "\n    ");
  }
}

Notice the isisMyprop() method, which should be named isMyprop().

HugoMario added a commit that referenced this issue Jun 9, 2018
Remove duplicate "is" as described in #91
@nardil
Copy link

nardil commented Dec 12, 2018

This issue is open for JavaJaxRs

 /**
   * Tells if the resource is enabled
   * @return enabled
  **/
  @JsonProperty("enabled")
  public Boolean isisEnabled() {  // <<<< Should be isEnabled
    return enabled;
  }

  public void setEnabled(Boolean enabled) {
    this.enabled = enabled;
  }

  public Entity enabled(Boolean enabled) {
    this.enabled = enabled;
    return this;
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants