Skip to content

fix: prevent StringIndexOutOfBoundsException in uniqueName with leading separators - #2396

Open
arimu1 wants to merge 1 commit into
swagger-api:masterfrom
arimu1:fix-2386-unique-name-separator
Open

fix: prevent StringIndexOutOfBoundsException in uniqueName with leading separators#2396
arimu1 wants to merge 1 commit into
swagger-api:masterfrom
arimu1:fix-2386-unique-name-separator

Conversation

@arimu1

@arimu1 arimu1 commented Aug 29, 2026

Copy link
Copy Markdown

Summary

  • Fix InlineModelResolver.uniqueName() to skip empty tokens produced by String.split() when camelCaseFlattenNaming is enabled, preventing StringIndexOutOfBoundsException on titles that start with separators (-, _, |, whitespace) or are empty.
  • Fall back to inline_object when the sanitized camel-case name would otherwise be blank.
  • Add unit tests covering leading separators, consecutive separators, empty title, and an end-to-end flatten scenario.

Fixes #2386

Test plan

  • mvn test (Java 17)
  • New tests: testUniqueNameSkipsEmptyTokensFromLeadingSeparators, testFlattenSchemaTitleWithLeadingSeparator

…ng separators

Skip empty tokens produced by split() when camelCaseFlattenNaming is enabled,
and fall back to inline_object when the sanitized name would otherwise be blank.

Fixes swagger-api#2386
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

InlineModelResolver.uniqueName throws StringIndexOutOfBoundsException for titles starting with a separator (camelCaseFlattenNaming)

1 participant