Skip to content

Commit

Permalink
Updated asyncapi constants generation test for number enums (#322)
Browse files Browse the repository at this point in the history
  • Loading branch information
neinoi authored Feb 9, 2024
1 parent 957b822 commit bc705d6
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import io.swagger.v3.oas.annotations.media.Schema;
import java.time.LocalDateTime;
import com.fasterxml.jackson.annotation.JsonFormat;
Expand All @@ -21,6 +22,29 @@ public class UserSignedUpPayload {
@JsonProperty(value ="createdAt")
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss")
private LocalDateTime createdAt;
@JsonProperty(value ="numberEnum")
private NumberEnum numberEnum;
public enum NumberEnum {
_1234("1234"),
_2345("2345"),
_3456("3456");

private String value;

NumberEnum(String value) {
this.value = value;
}

@JsonValue
public String getValue() {
return value;
}

@Override
public String toString() {
return String.valueOf(value);
}
}
@JsonProperty(value ="someOtherObject")
private SomeOtherObject someOtherObject;

Expand All @@ -29,6 +53,7 @@ private UserSignedUpPayload(UserSignedUpPayloadBuilder builder) {
this.lastName = builder.lastName;
this.email = builder.email;
this.createdAt = builder.createdAt;
this.numberEnum = builder.numberEnum;
this.someOtherObject = builder.someOtherObject;

}
Expand All @@ -48,13 +73,20 @@ public static class UserSignedUpPayloadBuilder {

private LocalDateTime createdAt;

private NumberEnum numberEnum;

private SomeOtherObject someOtherObject;

public UserSignedUpPayload.UserSignedUpPayloadBuilder createdAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
return this;
}

public UserSignedUpPayload.UserSignedUpPayloadBuilder numberEnum(NumberEnum numberEnum) {
this.numberEnum = numberEnum;
return this;
}

public UserSignedUpPayload.UserSignedUpPayloadBuilder someOtherObject(SomeOtherObject someOtherObject) {
this.someOtherObject = someOtherObject;
return this;
Expand Down Expand Up @@ -105,6 +137,18 @@ public void setCreatedAt(LocalDateTime createdAt) {
this.createdAt = createdAt;
}

/**
* Get numberEnum
* @return numberEnum
*/
@Schema(name = "numberEnum", required = false)
public NumberEnum getNumberEnum() {
return numberEnum;
}
public void setNumberEnum(NumberEnum numberEnum) {
this.numberEnum = numberEnum;
}

/**
* Get someOtherObject
* @return someOtherObject
Expand All @@ -126,12 +170,12 @@ public boolean equals(Object o) {
return false;
}
UserSignedUpPayload userSignedUpPayload = (UserSignedUpPayload) o;
return Objects.equals(this.firstName, userSignedUpPayload.firstName) && Objects.equals(this.lastName, userSignedUpPayload.lastName) && Objects.equals(this.email, userSignedUpPayload.email) && Objects.equals(this.createdAt, userSignedUpPayload.createdAt) && Objects.equals(this.someOtherObject, userSignedUpPayload.someOtherObject);
return Objects.equals(this.firstName, userSignedUpPayload.firstName) && Objects.equals(this.lastName, userSignedUpPayload.lastName) && Objects.equals(this.email, userSignedUpPayload.email) && Objects.equals(this.createdAt, userSignedUpPayload.createdAt) && Objects.equals(this.numberEnum, userSignedUpPayload.numberEnum) && Objects.equals(this.someOtherObject, userSignedUpPayload.someOtherObject);
}

@Override
public int hashCode() {
return Objects.hash(firstName, lastName, email, createdAt, someOtherObject);
return Objects.hash(firstName, lastName, email, createdAt, numberEnum, someOtherObject);
}

@Override
Expand All @@ -142,6 +186,7 @@ public String toString() {
sb.append(" lastName:").append(lastName).append(",");
sb.append(" email:").append(email).append(",");
sb.append(" createdAt:").append(createdAt).append(",");
sb.append(" numberEnum:").append(numberEnum).append(",");
sb.append(" someOtherObject:").append(someOtherObject);
sb.append("}");
return sb.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,12 @@ components:
createdAt:
type: string
format: date-time
numberEnum:
type: string
enum:
- '1234'
- '2345'
- '3456'
someOtherObject:
type: object
properties:
Expand Down

0 comments on commit bc705d6

Please sign in to comment.