spring-projects / spring-projects/spring-ai
RESPECT_JSONPROPERTY_ORDER not enabled in JsonSchemaGenerator
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 9.5k
- Forks
- 2.9k
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 5
Description
Hello,
Bug description
I've noticed a difference between the JacksonSchemaModule configuration in BeanOutputConverter.java and JsonSchemaGenerator.java.
In BeanOutputConverter.java there's JacksonOption.RESPECT_JSONPROPERTY_ORDER but not in JsonSchemaGenerator.java.
This setting is useful to set the reflexion property first for MistralAI and have a more accurate response.
IMO we can add the missing settings in JsonSchemaGenerator.java it shouldn't cause any harm.
Environment
Java 25, Spring Boot 4.0.5, SpringAI 2.0.0 M4
Steps to reproduce
Create a json schema with ResponseFormat.jsonSchema(MyExpectedOutput.class). With MyExpectedOutput containing @JsonPropertyOrder(...).
Expected behavior
The json schema should respect the @JsonPropertyOrder(...) annotation but it doesn't.
Contributor guide
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.
Research direction
Start by comparing the JacksonSchemaModule configuration in BeanOutputConverter.java and JsonSchemaGenerator.java, focusing on the missing JacksonOption.RESPECT_JSONPROPERTY_ORDER setting. Reproduce the issue with ResponseFormat.jsonSchema(MyExpectedOutput.class) and a class using @JsonPropertyOrder; done means the generated schema follows that declared property order.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java, spring-boot
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 72/100