Skip to content

Drop multijson dependency#385

Merged
LeFnord merged 2 commits intoruby-grape:masterfrom
ericproulx:drop_multijson_dependency
May 10, 2024
Merged

Drop multijson dependency#385
LeFnord merged 2 commits intoruby-grape:masterfrom
ericproulx:drop_multijson_dependency

Conversation

@ericproulx
Copy link
Copy Markdown
Contributor

This PR adds a Grape::Entity::Json class that will use multijson if already loaded instead of the default json.

A spec has been added to make sure to_json still works and moved require 'spec_helper' in .rspec file

ericproulx added 2 commits May 5, 2024 23:12
Add require spec_helper in rspec file
Add spec
@ericproulx
Copy link
Copy Markdown
Contributor Author

@LeFnord If you want to take a look :)

Copy link
Copy Markdown
Member

@LeFnord LeFnord left a comment

Choose a reason for hiding this comment

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

thanks @ericproulx … only one question

Comment thread lib/grape_entity/json.rb
Comment thread .rspec
Copy link
Copy Markdown
Member

@LeFnord LeFnord left a comment

Choose a reason for hiding this comment

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

thanks @ericproulx

@LeFnord LeFnord merged commit d42199e into ruby-grape:master May 10, 2024
numbata added a commit that referenced this pull request Apr 15, 2026
Both PRs were included in the 1.0.2 release but their CHANGELOG
entries were missing.
numbata pushed a commit that referenced this pull request Apr 16, 2026
The constant was copied over from grape when grape_entity/json.rb
was introduced, but grape-entity never parses JSON and so never
used it. Because the main grape gem also defines JSON::ParseError,
loading both gems produced `already initialized constant` warnings.

Dropping the assignment silences the warnings with no behavior
change. Originally flagged in #385 by @ericproulx.
numbata added a commit that referenced this pull request Apr 17, 2026
PR #385 replaced MultiJson.dump with JSON.dump which bypasses
ActiveSupport's Hash#to_json override, causing Time values to
serialize as "2026-04-16 10:55:10 UTC" instead of ISO 8601.

Restore direct multi_json dependency and MultiJson.dump call.
Remove the intermediate Grape::Entity::Json constant introduced
by #385 as it is no longer needed.

Fixes #403
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