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

Deprecate predicate inferring from class names #414

Merged
merged 1 commit into from
Jan 17, 2021

Conversation

flash-gordon
Copy link
Member

@flash-gordon flash-gordon merged commit b1cf70a into master Jan 17, 2021
@flash-gordon flash-gordon deleted the deprecate-class-name-inferring branch January 17, 2021 10:11
@doriantaylor
Copy link

doriantaylor commented Mar 28, 2022

I tried to fire up the code that caused me to file dry-rb/dry-schema#335 and now it complains with this deprecation error but there is ostensibly no future-proof way to have a Types.Constructor(::URI) (or I suppose Types.Instance(::URI)).

Given that certain class names are invariably going to collide with the predicate registry, is there not a way that this behaviour could be scoped to the actual type itself? Consider:

URIType = Types.Constructor(URI) do |x|
  # do some stuff with x
  URI.parse(x)
end

# something like this?
URIType.ignore_predicate_test = true

(Or, to be honest, I would be perfectly happy with a built-in URI type.)

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.

Dry::Types::Constructor(URI) triggers :uri? predicate with bad arity
3 participants