Skip to content

fix: keep quoted commas inside example slice and map values - #2183

Open
NoahStarkenburg wants to merge 1 commit into
swaggo:masterfrom
NoahStarkenburg:fix-example-quoted-commas
Open

fix: keep quoted commas inside example slice and map values#2183
NoahStarkenburg wants to merge 1 commit into
swaggo:masterfrom
NoahStarkenburg:fix-example-quoted-commas

Conversation

@NoahStarkenburg

Copy link
Copy Markdown

Fixes #899

A string slice example with quoted elements that contain commas was split on every comma, so example:"\"a,b,c\",\"a,b,c\"" produced ["a", "b", "c", "a", "b", "c"] instead of ["a,b,c", "a,b,c"].

defineTypeOfExample now splits on commas that are outside double quotes, for both the array and object branches. Unquoted values behave exactly as before.

Added tests covering quoted commas in array and object examples.

defineTypeOfExample split example values on every comma, so a quoted
element like "a,b,c" was broken into separate items. Split on commas
outside double quotes instead.
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.

Incorrect parsing of sample string slices containing commas

1 participant