Skip to content

Fix json.rb 2.7.2 compatibility#475

Merged
jkeen merged 1 commit into
graphiti-api:masterfrom
shrimple-tech:fix/current-json-rb-compatibility
Jun 26, 2024
Merged

Fix json.rb 2.7.2 compatibility#475
jkeen merged 1 commit into
graphiti-api:masterfrom
shrimple-tech:fix/current-json-rb-compatibility

Conversation

@factyy

@factyy factyy commented Jun 26, 2024

Copy link
Copy Markdown
Contributor

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
@jkeen

jkeen commented Jun 26, 2024

Copy link
Copy Markdown
Collaborator

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))
@github-actions

Copy link
Copy Markdown

🎉 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