Skip to content

JSON format support#239

Merged
rcpalacio merged 21 commits intomasterfrom
JSON_format_support
Jun 27, 2023
Merged

JSON format support#239
rcpalacio merged 21 commits intomasterfrom
JSON_format_support

Conversation

@rcpalacio
Copy link
Copy Markdown
Contributor

This adds a new parser to support JSON files.

The new parser tries to validate the JSON syntax in a file without actually parsing and loading a JSON object in memory for both performance and security reasons.

Comment thread lib/parsers/json_parser/validator.rb
Comment thread lib/parsers/json_parser/validator.rb Outdated
Comment thread lib/parsers/json_parser/validator.rb
Comment thread lib/parsers/json_parser/validator.rb
Comment thread lib/parsers/json_parser/validator.rb Outdated
Comment thread lib/utf8_reader.rb Outdated
Comment thread lib/utf8_reader.rb
Comment thread lib/parsers/json_parser/validator.rb
Comment thread spec/parsers/json_parser/validator_spec.rb Outdated
Comment thread spec/parsers/json_parser/validator_spec.rb
@enricoribelli
Copy link
Copy Markdown

Could you also update the README and up the version in version.rb ?

Comment thread lib/parsers/json_parser.rb Outdated
Copy link
Copy Markdown
Contributor

@linkyndy linkyndy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👌

Comment thread README.md Outdated
Comment thread lib/parsers/json_parser/validator.rb Outdated
Comment thread lib/utf8_reader.rb Outdated
rescue Validator::JSONParserError
nil
end
FormatParser.register_parser new, natures: :text, formats: :json
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to double check: when priority is not specified it means that it goes 'last' or let's say random with respect to ordered-through-priority parsers, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good point. The default priority is 99, which means a parser gets the least priority unless a priority is set explicitly.

@rcpalacio rcpalacio requested a review from linkyndy June 27, 2023 14:44
Copy link
Copy Markdown
Contributor

@linkyndy linkyndy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔥

@rcpalacio rcpalacio merged commit 46e328f into master Jun 27, 2023
@rcpalacio rcpalacio deleted the JSON_format_support branch June 27, 2023 14:46
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.

3 participants