jhipster / jhipster/prettier-java
Format record properties equivalent to class fields
- Dominant language
- Java
- Stars
- 1.2k
- Forks
- 120
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 27
Description
**Prettier-Java 1.6.0**
```sh
--print-width 80
```
**Input:**
```java
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:**
```java
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:**
```java
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).
Contributor guide
Assessment
This issue has not been assessed yet.