spring-projects / spring-projects/spring-ai

RESPECT_JSONPROPERTY_ORDER not enabled in JsonSchemaGenerator

Open Beginner friendly
#5,797 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: waiting-for-triage
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.