FasterXML / FasterXML/jackson-module-jsonSchema

Wrong schema generated

Đang mở
#158 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Java
Star
387
Fork
136
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Mô tả

Hello, I want to generate schema for carDto, which contains as attributes also four tireDto's. Here is exmaple of such dto's:

```
@Getter
@Setter
public class CarDto
{
private String licencePlate;
private String vin;
private String brand;
private String model;
private TireDto tireFrontLeft;
private TireDto tireFrontRight;
private TireDto tireBackLeft;
private TireDto tireBackRight;
}
```

```
@Getter
@Setter
public class TireDto
{
private String tireBrand;
private String tireModel;
private String dimension;
private String season;
}
```

Here is the test how I want to generate schema:
```
@Test
void shouldGenerateValidSchema() throws IOException {
SimpleModule module = new SimpleModule();
ObjectMapper objectMapper = new ObjectMapper();
objectMapper.registerModule(module);

ObjectSchema dtoSchema = (ObjectSchema) new JsonSchemaGenerator(objectMapper).generateSchema(CarDto.class);

System.out.println(dtoSchema.getProperties());
}
```
I would expect that all attributes of class TireDto (tireFrontLeft, tireFrontRight, tireBackLeft and tireBackRight) will be instances of the same schema. But it is not like that. First attribute tireFrontLeft is instance of ObjectSchema and all others (tireFrontRight, tireBackLeft and tireBackRight) are instances of ReferenceSchema. Besides that, only tireFrontLeft contains also properties of TireDto.

Here I'm also attaching screenshot from debugging.
![image](https://github.com/FasterXML/jackson-module-jsonSchema/assets/36663893/3c686df1-602f-4493-9777-ebbb93bb4bae)

So is it a bug, or I'm missing some configuration?

Hướng dẫn đóng góp

Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.