GH-5797: Add RESPECT_JSONPROPERTY_ORDER to JsonSchemaGenerator#5847
Open
suryateja-g13 wants to merge 1 commit intospring-projects:mainfrom
Open
GH-5797: Add RESPECT_JSONPROPERTY_ORDER to JsonSchemaGenerator#5847suryateja-g13 wants to merge 1 commit intospring-projects:mainfrom
suryateja-g13 wants to merge 1 commit intospring-projects:mainfrom
Conversation
…enerator BeanOutputConverter already included JacksonOption.RESPECT_JSONPROPERTY_ORDER in its JacksonSchemaModule configuration, but JsonSchemaGenerator did not. This caused @JsonPropertyOrder annotations to be silently ignored when generating schemas via ResponseFormat.jsonSchema() or any path that uses JsonSchemaGenerator directly. Add the missing option to keep both code paths consistent. Fixes spring-projectsGH-5797 (spring-projects#5797) Signed-off-by: Gorre Surya <sgorre92@gmail.com>
anuragg-saxenaa
approved these changes
Apr 21, 2026
anuragg-saxenaa
left a comment
There was a problem hiding this comment.
LGTM. Single-line addition: adds RESPECT_JSONPROPERTY_ORDER to JsonSchemaGenerator schema module options, matching BeanOutputConverter config. Eliminates silent failure of @JsonPropertyOrder annotations. Clean fix, well-scoped.
|
LGTM. Adds JacksonOption.RESPECT_JSONPROPERTY_ORDER to JacksonSchemaModule — focused and correct. Test verifies the ordering matches the annotation. Ship it. |
redinside-dev
approved these changes
Apr 22, 2026
redinside-dev
left a comment
There was a problem hiding this comment.
LGTM. Tiny, targeted fix that aligns with by adding the missing option to the configuration. The test covers the annotation case thoroughly. Simple, correct, shipped.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thank you for taking time to contribute this pull request!
Problem
BeanOutputConverterconfigures itsJacksonSchemaModulewith bothJacksonOption.RESPECT_JSONPROPERTY_REQUIREDandJacksonOption.RESPECT_JSONPROPERTY_ORDER, butJsonSchemaGeneratoronly includesRESPECT_JSONPROPERTY_REQUIRED.This inconsistency means
@JsonPropertyOrderannotations are silently ignored when generating schemas throughJsonSchemaGenerator(e.g. viaResponseFormat.jsonSchema(MyClass.class)), even though they work correctly viaBeanOutputConverter.Solution
Add the missing
JacksonOption.RESPECT_JSONPROPERTY_ORDERoption to theJacksonSchemaModuleconfiguration inJsonSchemaGenerator, aligning it withBeanOutputConverter.Changes
JsonSchemaGenerator.java— addedJacksonOption.RESPECT_JSONPROPERTY_ORDERtoJacksonSchemaModuleconstructorJsonSchemaGeneratorTests.java— addedgenerateSchemaForTypeRespectsJsonPropertyOrdertest using an@JsonPropertyOrder-annotated class; verified the schema properties are emitted in the declared orderChecklist
Signed-off-byline to commit (DCO)mainmvn package -pl spring-ai-model)Fixes #5797