Wrong schema generated
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- java
- Domain
- backend-api-design
Research direction
Start with the CarDto and TireDto examples and the test using JsonSchemaGenerator.generateSchema(CarDto.class). Inspect how the generator represents the first TireDto property versus later references, then compare that behavior with the expected repeated schema structure. Done means the behavior is corrected or the required configuration is clearly identified and covered by the reproduction test.
Written by the indexing model from the issue text.
Description
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.
So is it a bug, or I'm missing some configuration?
- Dominant language
- Java
- Stars
- 387
- Forks
- 138
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from FasterXML/jackson-module-jsonSchema
-
Difficulty 4/5 3-5 days Newbie friendliness 38/100
FasterXML/jackson-module-jsonSchema#160 · 3 comments ·
-
pr-needed
Difficulty 3/5 1-2 days Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#136 · 10 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
FasterXML/jackson-module-jsonSchema#135 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
FasterXML/jackson-module-jsonSchema#134 · 2 comments · 1 reaction ·
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
FasterXML/jackson-module-jsonSchema#133 · 1 comment ·
All issues in FasterXML/jackson-module-jsonSchema
Similar issues
-
[Bug] DefaultSerializationExceptionWrapper does not implement Cleanable, so cleanup() is never invoked by codecsPossibly taken @binbin0325 claimed this today. Opencomponent/need-triage type/need-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
2026 Error Report
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
triplea-game/triplea#15096 ·
Maintainers usually reply within 1 day
-
[Bug][API] Switching workflow versions leaves schedules onlinePossibly taken @zhuangchong claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
apache/dolphinscheduler#18731 ·
Maintainers usually reply within 1 day
-
Implement JDBC Domain Enums (`SqlCategory`, `SqlExecutionStatus`, `SqlExecutionType`) in Core ModuleOpencore-module enhancement good first issue
Difficulty 1/5 1-3 hours Newbie friendliness 87/100
sdlc-pro/spring-lens#531 ·
Maintainers usually reply within 1 day