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

Format record properties equivalent to class fields #520

Open
laukerta opened this issue Nov 22, 2021 · 0 comments
Open

Format record properties equivalent to class fields #520

laukerta opened this issue Nov 22, 2021 · 0 comments

Comments

@laukerta
Copy link

Prettier-Java 1.6.0

--print-width 80

Input:

public record PolicyDto(
  @NotNull
  @Pattern(regexp = "\\d{10}")
  String policyNumber,

  @NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,

  @NotNull
  @JsonSerialize(using = ContractStateSerializer.class)
  @Schema(type = "integer", description = "some description")
  ContractState contractState
) {}

Output:

public record PolicyDto(
  @NotNull @Pattern(regexp = "\\d{10}") String policyNumber,

  @NotEmpty List<@NotNull @Valid ContractRelationDto> contractRelations,

  @NotNull
  @JsonSerialize(using = ContractStateSerializer.class)
  @Schema(type = "integer", description = "some description")
  ContractState contractState
) {}

Expected behavior:

public record PolicyDto(
  @NotNull
  @Pattern(regexp = "\\d{10}")
  String policyNumber,

  @NotEmpty
  List<@NotNull @Valid ContractRelationDto> contractRelations,

  @NotNull
  @JsonSerialize(using = ContractStateSerializer.class)
  @Schema(type = "integer", description = "some description")
  ContractState contractState
) {}

Format document properties equivalent to class fields. For this, each annotation needs to be put on a separate line (regardless of whether the print-width is exceeded).

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

1 participant