Skip to content

Commit

Permalink
add test parameter and fix whitespace control
Browse files Browse the repository at this point in the history
  • Loading branch information
maltesmann committed Nov 19, 2024
1 parent 083b686 commit e10eb6c
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,9 @@ public class {{allName}} {
public {{propType}} get{{className}}() {
return {{varName}};
}

{% if prop.deprecated() -%}@Deprecated{%- endif %}
{% if prop.deprecated() %}
@Deprecated
{%- endif %}
public void set{{className}}({{propType}} {{varName}}) {
this.{{varName}} = {{varName}};
}
Expand Down Expand Up @@ -201,4 +202,4 @@ private String toIndentedString(Object o) {
}
return o.toString().replace("\n", "\n ");
}
}
}
22 changes: 20 additions & 2 deletions tests/__snapshots__/additional-formats.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public class SongPayload {
private @Valid java.math.BigDecimal rating;
private @Valid Integer stars;
Expand Down Expand Up @@ -97,6 +99,20 @@ public class SongPayload {
this.rating = rating;
}
/**
* Number of stars. Deprecated: Use rating
*/
@JsonProperty("stars")@Deprecated
public Integer getStars() {
return stars;
}
@Deprecated
public void setStars(Integer stars) {
this.stars = stars;
}
@Override
public boolean equals(Object o) {
if (this == o) {
Expand All @@ -111,12 +127,13 @@ public class SongPayload {
Objects.equals(this.title, songPayload.title) &&
Objects.equals(this.uri, songPayload.uri) &&
Objects.equals(this.email, songPayload.email) &&
Objects.equals(this.rating, songPayload.rating);
Objects.equals(this.rating, songPayload.rating) &&
Objects.equals(this.stars, songPayload.stars);
}
@Override
public int hashCode() {
return Objects.hash(id, title, uri, email, rating);
return Objects.hash(id, title, uri, email, rating, stars);
}
@Override
Expand All @@ -128,6 +145,7 @@ public class SongPayload {
" uri: " + toIndentedString(uri) + "\\n" +
" email: " + toIndentedString(email) + "\\n" +
" rating: " + toIndentedString(rating) + "\\n" +
" stars: " + toIndentedString(stars) + "\\n" +
"}";
}
Expand Down
6 changes: 5 additions & 1 deletion tests/mocks/additional-type-formats.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,8 @@ components:
rating:
description: Title rating
type: string
format: decimal
format: decimal
stars:
description: "Number of stars. Deprecated: Use rating"
type: integer
deprecated: true

0 comments on commit e10eb6c

Please sign in to comment.