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

Dry::Schema::Messages::Abstract undefined #459

Closed
krainboltgreene opened this issue Apr 24, 2023 · 7 comments
Closed

Dry::Schema::Messages::Abstract undefined #459

krainboltgreene opened this issue Apr 24, 2023 · 7 comments

Comments

@krainboltgreene
Copy link

Describe the bug

Dry::Schema::Messages::Abstract in my application doesn't exist and I don't see anywhere in the gem where it's required?

From: /Users/krainboltgreene/.asdf/installs/ruby/3.1.2/lib/ruby/gems/3.1.0/gems/dry-schema-1.13.0/lib/dry/schema/messages.rb:23 Dry::Schema::Messages.setup:

    16: public def setup(config)
    17:   backend_class = BACKENDS.fetch(config.backend) do
    18:     raise "+#{config.backend}+ is not a valid messages identifier"
    19:   end
    20: 
    21:   namespace = config.namespace
    22:   binding.pry
 => 23:   options = config.to_h.select { |k, _| Abstract.setting_names.include?(k) }

My environment

  • Affects my production application: YES/NO
  • Ruby version: 3.1.2
@flash-gordon
Copy link
Member

@contentfree
Copy link

Zeitwerk doesn't autoload it for me. I'm getting this error too:

/usr/local/bundle/gems/dry-schema-1.13.3/lib/dry/schema/messages.rb:22:in `block in setup': uninitialized constant Dry::Schema::Messages::Abstract (NameError)

        options = config.to_h.select { |k, _| Abstract.setting_names.include?(k) }
                                              ^^^^^^^^
        from /usr/local/bundle/gems/dry-schema-1.13.3/lib/dry/schema/messages.rb:22:in `select'
        from /usr/local/bundle/gems/dry-schema-1.13.3/lib/dry/schema/messages.rb:22:in `setup'
        from /usr/local/bundle/gems/dry-schema-1.13.3/lib/dry/schema/rule_applier.rb:21:in `block in <class:RuleApplier>'

@flash-gordon
Copy link
Member

@contentfree do you have require 'dry/schema' anywhere that runs before?

@contentfree
Copy link

contentfree commented Nov 9, 2023 via email

@flash-gordon
Copy link
Member

Then you'll need to add it somewhere and it should work.

@contentfree
Copy link

I still get this after adding require 'dry/schema'. To fix, I have to require 'dry/schema/messages/abstract' explicitly.

@flash-gordon
Copy link
Member

That's odd. I suggest you update other dry-* dependencies as well, it may be the cause. If this doesn't help, check if your code doesn't contain specific require's like require 'dry/schema/messages/abstract' and has require 'dry/schema' instead.

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

No branches or pull requests

3 participants