Skip to content

Remove Json::ParseError assignment#402

Merged
numbata merged 2 commits intoruby-grape:masterfrom
olivier-thatch:remove-parse-error
Apr 16, 2026
Merged

Remove Json::ParseError assignment#402
numbata merged 2 commits intoruby-grape:masterfrom
olivier-thatch:remove-parse-error

Conversation

@olivier-thatch
Copy link
Copy Markdown
Contributor

#385 was merged and released in grape-entity 1.0.2 (cf. changelog).

However, the main grape gem also defines ParseError, which produces ugly warnings:

/Users/olivier/.rbenv/versions/4.0.2/lib/ruby/gems/4.0.0/gems/grape-entity-1.0.3/lib/grape_entity/json.rb:9: warning: already initialized constant JSON::ParseError
/Users/olivier/.rbenv/versions/4.0.2/lib/ruby/gems/4.0.0/gems/grape-3.2.0/lib/grape/json.rb:8: warning: previous definition of ParseError was here
/Users/olivier/.rbenv/versions/4.0.2/lib/ruby/gems/4.0.0/gems/grape-entity-1.0.3/lib/grape_entity/json.rb:9: warning: already initialized constant JSON::ParseError
/Users/olivier/.rbenv/versions/4.0.2/lib/ruby/gems/4.0.0/gems/grape-3.2.0/lib/grape/json.rb:8: warning: previous definition of ParseError was here

Since grape-entity makes no use of ParseError (cf. https://github.com/ruby-grape/grape-entity/pull/385/changes#r1594479678), we can drop the assignment entirely.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 15, 2026

Danger Report

No issues found.

View run

@numbata
Copy link
Copy Markdown
Collaborator

numbata commented Apr 15, 2026

Thanks @olivier-thatch ! Good catch on the duplicate constant warnings.

This was also noted in PR that you mentioned. Since grape-entity doesn't do any JSON parsing, the ParseError assignment was unnecessary from the start.

Could you add a CHANGELOG entry as Danger suggests?

@numbata numbata merged commit b32714d into ruby-grape:master Apr 16, 2026
7 checks passed
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.

2 participants