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 json.rb 2.7.2 compatibility #475

Merged

Conversation

factyy
Copy link
Contributor

@factyy factyy commented Jun 26, 2024

Stdlib's json.rb now (since version 2.7.2) relies on GenericObject which is autoloaded later (see https://github.com/ruby/ruby/blob/9d69619623ec6b86c464b7cac911b7201f74dab7/ext/json/lib/json/common.rb#L5).

This change makes Graphiti unable to be required.

If you try to require 'graphiti' you end up with the following error:

...gems/graphiti-1.7.2/lib/graphiti/resource/remote.rb:8:in `block in <module:Remote>': uninitialized constant Graphiti::Resource::Remote::OpenStruct (NameError)

        self.model = OpenStruct
                     ^^^^^^^^^^
	from ...gems/activesupport-7.1.3.4/lib/active_support/concern.rb:138:in `class_eval'
	from ...gems/activesupport-7.1.3.4/lib/active_support/concern.rb:138:in `append_features'
	from ...gems/graphiti-1.7.2/lib/graphiti/resource/configuration.rb:48:in `include'
	from ...gems/graphiti-1.7.2/lib/graphiti/resource/configuration.rb:48:in `remote='

This PR simply requires OpenStruct explicitly (if not already loaded).

@jkeen jkeen merged commit e0fa18a into graphiti-api:master Jun 26, 2024
36 checks passed
@jkeen
Copy link
Collaborator

jkeen commented Jun 26, 2024

Thanks!

github-actions bot pushed a commit that referenced this pull request Jun 26, 2024
## [1.7.3](v1.7.2...v1.7.3) (2024-06-26)

### Bug Fixes

* require OpenStruct explicitly ([#475](#475)) ([e0fa18a](e0fa18a))
Copy link

🎉 This PR is included in version 1.7.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants