bugfix/fix nested array schema generation for GeoJSON MultiPolygon coordinates#2765
Open
hongwei1 wants to merge 2 commits intoOpenBankProject:developfrom
Open
bugfix/fix nested array schema generation for GeoJSON MultiPolygon coordinates#2765hongwei1 wants to merge 2 commits intoOpenBankProject:developfrom
hongwei1 wants to merge 2 commits intoOpenBankProject:developfrom
Conversation
|
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.



Summary
Fix OpenAPI schema generator bug where deeply nested arrays (like GeoJSON MultiPolygon coordinates:
number[][][][]) were incorrectly converted to nested objects with "arr" properties instead of proper nested array types.Problem
When
translateEntityencountered aJArraycontaining anotherJArray, it used reflection to extract fields from theJArrayclass, which exposed the internalarrfield. This resulted in incorrect schema generation.Before (Buggy):
{ "type": "object", "properties": { "arr": { "type": "array", "items": { "type": "object", "properties": { "arr": {...} } } } } }After (Fixed):
{ "type": "array", "items": { "type": "array", "items": { "type": "integer" } } }Solution
Added explicit handling for
JArrayelements in the pattern matching logic:isNestedArrayto detect JArray containing JArrayJArraycases before reflectionTesting
All 17 tests passed (100% pass rate):
Bug Condition Tests (4/4 passed)
Preservation Tests (13/13 passed)
Zero regressions - all existing functionality preserved.
Files Modified
obp-api/src/main/scala/code/api/v1_4_0/JSONFactory1_4_0.scalaisNestedArrayhelper functionobp-api/src/test/scala/code/api/v1_4_0/JSONFactory1_4_0NestedArrayTest.scalaImpact
This fix enables correct OpenAPI schema generation for:
number[][][][])All existing functionality is preserved with zero regressions.
Commit
998308005bugfix/fix nested array schema generation for GeoJSON MultiPolygon coordinates