Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check that last_non_whitespace_character is not an empty string #105

Closed
wants to merge 1 commit into from

Conversation

NJordan72
Copy link
Contributor

Fixes the problem where JSON Schema could end up with leading commas. The problem was that last_non_whitespace_character is set to an empty string if there has not been a non whitespace character, but the check that increments num_items didn't handle that case.

Dealign with the empty string is a bit unsatisfying, but I didn't feel comfortable with all of the implications of refactoring it other than to add the check.

Resolves #99

@noamgat
Copy link
Owner

noamgat commented May 17, 2024

Thank you for finding this!
last_non_whitespace_character should never be an empty string once the parsing encountered one non whitespace character, so I solved it in the correct way:
5461294

@noamgat noamgat closed this May 17, 2024
@NJordan72 NJordan72 deleted the fix/leading-comma branch May 17, 2024 08:14
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.

Leading Comma in JSON Array
2 participants