Skip to content

dry schema fails on some algebraic data types #494

@cramt

Description

@cramt

Describe the bug

A clear and concise description of what the bug is.
i get this error when the schema is called

undefined method `visit_intersection' for an instance of Dry::Schema::PredicateInferrer::Compiler (NoMethodError)

To Reproduce

made a nice little mvp

sum_type = (Types::Hash.schema(a: Types::String) & (Types::Hash.schema(b: Types::String) | Types::Hash.schema(c: Types::String)))
Dry::Schema.Params do required(:body).value(sum_type) end.call(body: {a: "", b: ""}).to_h

Expected behavior

The expected result here should be {a: "", b: ""}

My environment

  • Affects my production application: NO
  • Ruby version: 3.3.9
  • OS: nixos

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions