# Latest

**URL:** https://discourse.dry-rb.org/latest.md?page=1

[Latest](https://discourse.dry-rb.org/latest.md) · [Categories](https://discourse.dry-rb.org/categories.md)

**Page:** 2

---

## [Stubbing not working at all with dry-rails](https://discourse.dry-rb.org/t/stubbing-not-working-at-all-with-dry-rails/1850)

<div class="topic-metadata">

**Author:** [@sdhull](https://discourse.dry-rb.org/u/sdhull)\
**Replies:** 2\
**Last updated:** [October 18, 2024, 5:11pm UTC](https://discourse.dry-rb.org/t/stubbing-not-working-at-all-with-dry-rails/1850 "2024-10-18T17:11:14Z")

</div>

We’re on dry-rails 0.7.0 and I tried adding require "dry/container/stub" MyApp::Container.enable\_stubs! To our rails\_helper and I just get a NoMethodError: Failure/Error: MyApp::Container.enable\_stubs! NoMethodError…

---

## [dry-validation: validate\_keys for nested array](https://discourse.dry-rb.org/t/dry-validation-validate-keys-for-nested-array/1852)

<div class="topic-metadata">

**Author:** [@dmke](https://discourse.dry-rb.org/u/dmke)\
**Replies:** 1\
**Last updated:** [October 17, 2024, 1:17pm UTC](https://discourse.dry-rb.org/t/dry-validation-validate-keys-for-nested-array/1852 "2024-10-17T13:17:19Z")

</div>

I’m trying to catch unexpected keys in my (Rails-) API, using the following (simplified) code: require "dry-validation" class C \< Dry::Validation::Contract config.validate\_keys = true params do required(:name)…

---

## [Usage of "did you mean" for command with typos in dry-cli](https://discourse.dry-rb.org/t/usage-of-did-you-mean-for-command-with-typos-in-dry-cli/1824)

<div class="topic-metadata">

**Author:** [@benoittgt](https://discourse.dry-rb.org/u/benoittgt)\
**Replies:** 3\
**Last updated:** [October 15, 2024, 4:27am UTC](https://discourse.dry-rb.org/t/usage-of-did-you-mean-for-command-with-typos-in-dry-cli/1824 "2024-10-15T04:27:48Z")

</div>

Hello Would you be interested to add GitHub - ruby/did\_you\_mean: The gem that has been saving people from typos since 2014 help when the command provided is close to an existing command ? Same with command flags.

---

## [NameError: uninitialized constant Dry::Validation::Contract::ClassInterface when using binding.pry inside spec examples](https://discourse.dry-rb.org/t/nameerror-uninitialized-constant-dry-classinterface-when-using-binding-pry-inside-spec-examples/1646)

<div class="topic-metadata">

**Author:** [@barmic](https://discourse.dry-rb.org/u/barmic)\
**Replies:** 2\
**Last updated:** [October 7, 2024, 12:57pm UTC](https://discourse.dry-rb.org/t/nameerror-uninitialized-constant-dry-classinterface-when-using-binding-pry-inside-spec-examples/1646 "2024-10-07T12:57:40Z")

</div>

Hello, in the project I use dry-validation gem. When I use binding.pry inside rspec examples and call the subject: subject(:update\_store) { described\_class.new(partner.user, params).call } .... it "creates 2 opening…

---

## [dry-validation, custom field name](https://discourse.dry-rb.org/t/dry-validation-custom-field-name/1847)

<div class="topic-metadata">

**Author:** [@radar](https://discourse.dry-rb.org/u/radar)\
**Replies:** 0\
**Last updated:** [September 28, 2024, 10:52pm UTC](https://discourse.dry-rb.org/t/dry-validation-custom-field-name/1847 "2024-09-28T22:52:35Z")

</div>

I’m trying to output a custom field name for a validation: require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'dry-validation' end require 'dry-validation' class RowValidator \< Dry::Validation:…

---

## [Dry-auto-inject. Inject dependencies with Procs](https://discourse.dry-rb.org/t/dry-auto-inject-inject-dependencies-with-procs/1846)

<div class="topic-metadata">

**Author:** [@aglushkov](https://discourse.dry-rb.org/u/aglushkov)\
**Replies:** 0\
**Last updated:** [September 25, 2024, 1:47pm UTC](https://discourse.dry-rb.org/t/dry-auto-inject-inject-dependencies-with-procs/1846 "2024-09-25T13:47:59Z")

</div>

Hey, injecting dependencies with Procs can be super handy. Pros: Code editor navigation to a dependency class will work Application code will be simplified, as you don’t need to put every service class to the “contain…

---

## [Run dry-cli script in other ruby projects](https://discourse.dry-rb.org/t/run-dry-cli-script-in-other-ruby-projects/1804)

<div class="topic-metadata">

**Author:** [@adrianthedev](https://discourse.dry-rb.org/u/adrianthedev)\
**Replies:** 5\
**Last updated:** [September 3, 2024, 12:06am UTC](https://discourse.dry-rb.org/t/run-dry-cli-script-in-other-ruby-projects/1804 "2024-09-03T00:06:03Z")

</div>

I have this cli built with dry-cli and a couple of other gems. The way I’d like to run it is to keep it in my current directory (the repo where I’m working on it) and be able to run it globally on my machine What I did…

---

## [JSON Schema support for excluded\_from? and eql?](https://discourse.dry-rb.org/t/json-schema-support-for-excluded-from-and-eql/1841)

<div class="topic-metadata">

**Author:** [@mannerheim77](https://discourse.dry-rb.org/u/mannerheim77)\
**Replies:** 0\
**Last updated:** [August 26, 2024, 8:58pm UTC](https://discourse.dry-rb.org/t/json-schema-support-for-excluded-from-and-eql/1841 "2024-08-26T20:58:22Z")

</div>

Curious why excluded\_from? and eql? aren’t supported as mappings in schema\_compiler.rb? Figured eql? could just map to enum with a single value, right? And excluded\_from? could be mapped to {not: {enum: -\>(v, \_) { v.to…

---

## [Storing user created dry-schema in a database](https://discourse.dry-rb.org/t/storing-user-created-dry-schema-in-a-database/1838)

<div class="topic-metadata">

**Author:** [@sled](https://discourse.dry-rb.org/u/sled)\
**Replies:** 1\
**Last updated:** [August 22, 2024, 6:19pm UTC](https://discourse.dry-rb.org/t/storing-user-created-dry-schema-in-a-database/1838 "2024-08-22T18:19:13Z")

</div>

I’m working on a web application that let’s the user define input / output data structures through an user interface. Now I’m wondering if I could leverage dry-schema in the background and build “anonymous” schema defi…

---

## [Make included\_in constrain dynamic](https://discourse.dry-rb.org/t/make-included-in-constrain-dynamic/1834)

<div class="topic-metadata">

**Author:** [@milushov](https://discourse.dry-rb.org/u/milushov)\
**Replies:** 5\
**Last updated:** [August 14, 2024, 12:19pm UTC](https://discourse.dry-rb.org/t/make-included-in-constrain-dynamic/1834 "2024-08-14T12:19:20Z")

</div>

Hello everyone, I’m currently using dry-types version 1.7.2 in a large project, and I need to update a custom type to work with a dynamic list for the included\_in constraint without breaking existing tests. Previously,…

---

## [Why was dry-transaction deprecated?](https://discourse.dry-rb.org/t/why-was-dry-transaction-deprecated/1822)

<div class="topic-metadata">

**Author:** [@wilsonsilva](https://discourse.dry-rb.org/u/wilsonsilva)\
**Replies:** 4\
**Last updated:** [August 12, 2024, 7:42pm UTC](https://discourse.dry-rb.org/t/why-was-dry-transaction-deprecated/1822 "2024-08-12T19:42:03Z")

</div>

I remember reading why dry-transaction was deprecated a few years ago, but now I can’t find that page. I would also love to know what makes dry-operation a good replacement.

---

## [Can dry-rb ecosystem be considered for implementing a simple DSL for deployment automation?](https://discourse.dry-rb.org/t/can-dry-rb-ecosystem-be-considered-for-implementing-a-simple-dsl-for-deployment-automation/1820)

<div class="topic-metadata">

**Author:** [@jignesh](https://discourse.dry-rb.org/u/jignesh)\
**Replies:** 2\
**Last updated:** [August 9, 2024, 6:23pm UTC](https://discourse.dry-rb.org/t/can-dry-rb-ecosystem-be-considered-for-implementing-a-simple-dsl-for-deployment-automation/1820 "2024-08-09T18:23:45Z")

</div>

In Ruby ecosystem the most popular deployment automation tool is Capistrano. Recently I came across a promising alternative GitHub - mattbrictson/tomo: A friendly CLI for deploying Rails apps ✨. I really liked the simpli…

---

## [dry-cli option to hide command](https://discourse.dry-rb.org/t/dry-cli-option-to-hide-command/1823)

<div class="topic-metadata">

**Author:** [@benoittgt](https://discourse.dry-rb.org/u/benoittgt)\
**Replies:** 1\
**Last updated:** [August 9, 2024, 9:44am UTC](https://discourse.dry-rb.org/t/dry-cli-option-to-hide-command/1823 "2024-08-09T09:44:40Z")

</div>

Hello I am using GitHub - rngtng/dry-cli-completion: Dry::CLI Command to generate a completion script for bash/zsh But I would like to hide this command from --help. Thor as and argument “hidden”, but I am wondering if…

---

## [Best practices for using Dry-Types, Dry-Schema, Dry-Validation, and Dry-Struct together in our apps](https://discourse.dry-rb.org/t/best-practices-for-using-dry-types-dry-schema-dry-validation-and-dry-struct-together-in-our-apps/1821)

<div class="topic-metadata">

**Author:** [@Damian](https://discourse.dry-rb.org/u/Damian)\
**Replies:** 1\
**Last updated:** [August 7, 2024, 3:00am UTC](https://discourse.dry-rb.org/t/best-practices-for-using-dry-types-dry-schema-dry-validation-and-dry-struct-together-in-our-apps/1821 "2024-08-07T03:00:19Z")

</div>

I am exploring app development with Hanami 2, which has led me to dive into the Dry-rb ecosystem as well. Loving it so far! :heart: I am having some trouble understanding how to coordinate my usage of the various Dry-rb…

---

## [\[Dry-Schema\] TS Generation?](https://discourse.dry-rb.org/t/dry-schema-ts-generation/1818)

<div class="topic-metadata">

**Author:** [@emilsosa](https://discourse.dry-rb.org/u/emilsosa)\
**Replies:** 0\
**Last updated:** [July 29, 2024, 2:11am UTC](https://discourse.dry-rb.org/t/dry-schema-ts-generation/1818 "2024-07-29T02:11:02Z")

</div>

I’m new to the dry ecosystem, but it is pretty cool. :slight\_smile: I’m wondering if there is any gem that will analyze dry-schemas and generate Typescript from it?

---

## [Default values and #try](https://discourse.dry-rb.org/t/default-values-and-try/1817)

<div class="topic-metadata">

**Author:** [@elcuervo](https://discourse.dry-rb.org/u/elcuervo)\
**Replies:** 3\
**Last updated:** [July 24, 2024, 7:41pm UTC](https://discourse.dry-rb.org/t/default-values-and-try/1817 "2024-07-24T19:41:19Z")

</div>

EDIT: As correctly pointed by @alassek this is related to a known issue with #try and Default I was expecting to be able to use to\_monad on a type with default values. Is this an expected behavior or am I missing somet…

---

## [Injecting dynamic values for a specific schema to validate against](https://discourse.dry-rb.org/t/injecting-dynamic-values-for-a-specific-schema-to-validate-against/1815)

<div class="topic-metadata">

**Author:** [@flexaddicted](https://discourse.dry-rb.org/u/flexaddicted)\
**Replies:** 0\
**Last updated:** [July 19, 2024, 9:37am UTC](https://discourse.dry-rb.org/t/injecting-dynamic-values-for-a-specific-schema-to-validate-against/1815 "2024-07-19T09:37:23Z")

</div>

Hello, I have the following yaml file that I would like to validate using dry-rb. --- environment: # required test: # should be dynamic service\_credentials: "test\_credentials" # required stage: service\_cred…

---

## [XOR operation/type](https://discourse.dry-rb.org/t/xor-operation-type/1812)

<div class="topic-metadata">

**Author:** [@elcuervo](https://discourse.dry-rb.org/u/elcuervo)\
**Replies:** 0\
**Last updated:** [July 11, 2024, 6:19pm UTC](https://discourse.dry-rb.org/t/xor-operation-type/1812 "2024-07-11T18:19:34Z")

</div>

I’ve been fiddling around with ideas trying to find how would a xor type would look like. I wonder if there’s been any conversation for a ^ operator between types. So far, and just for fun I have this as a naive idea: …

---

## [\[Dry-Struct\] How to create a nested struct in an optional array?](https://discourse.dry-rb.org/t/dry-struct-how-to-create-a-nested-struct-in-an-optional-array/1810)

<div class="topic-metadata">

**Author:** [@BonMatts](https://discourse.dry-rb.org/u/BonMatts)\
**Replies:** 3\
**Last updated:** [July 10, 2024, 10:08pm UTC](https://discourse.dry-rb.org/t/dry-struct-how-to-create-a-nested-struct-in-an-optional-array/1810 "2024-07-10T22:08:35Z")

</div>

I’m trying to create an attrbute that is an optional array with a nested struct. I’ve tried attribute :someArray, Types::Array.of( Dry::Schema.optional do attribute :someString, Types::String attribute :someInteger, …

---

## [Types code organization](https://discourse.dry-rb.org/t/types-code-organization/1808)

<div class="topic-metadata">

**Author:** [@elcuervo](https://discourse.dry-rb.org/u/elcuervo)\
**Replies:** 2\
**Last updated:** [July 10, 2024, 7:59pm UTC](https://discourse.dry-rb.org/t/types-code-organization/1808 "2024-07-10T19:59:48Z")

</div>

I’m heavily pushing dry-types where I work because I feel that is providing a lot of value understanding the data structures we handle. Now I’ve been going back and forward on how to organize the types in a clean way tr…

---

## [Schema composition](https://discourse.dry-rb.org/t/schema-composition/1806)

<div class="topic-metadata">

**Author:** [@beechnut](https://discourse.dry-rb.org/u/beechnut)\
**Replies:** 3\
**Last updated:** [July 10, 2024, 7:30pm UTC](https://discourse.dry-rb.org/t/schema-composition/1806 "2024-07-10T19:30:12Z")

</div>

Hi dry-rb community! Forgive me if I’m asking a repeat question, but I’ve searched issues and forums and tried quite a bit of experimentation, but I’m still not able to solve my issue. I’m using dry-schema / dry-validat…

---

## [Access default value in the type AST](https://discourse.dry-rb.org/t/access-default-value-in-the-type-ast/1789)

<div class="topic-metadata">

**Author:** [@elcuervo](https://discourse.dry-rb.org/u/elcuervo)\
**Replies:** 2\
**Last updated:** [July 5, 2024, 2:07pm UTC](https://discourse.dry-rb.org/t/access-default-value-in-the-type-ast/1789 "2024-07-05T14:07:02Z")

</div>

Hello! I wonder if there’s a way to access the default value of a type while parsing the AST. I’m building a gem to translate types into other structures and having the default value would help. Types::String.default(…

---

## [Using boolean-like predicates as constraints in dry-types](https://discourse.dry-rb.org/t/using-boolean-like-predicates-as-constraints-in-dry-types/1807)

<div class="topic-metadata">

**Author:** [@Damian](https://discourse.dry-rb.org/u/Damian)\
**Replies:** 2\
**Last updated:** [July 3, 2024, 6:19pm UTC](https://discourse.dry-rb.org/t/using-boolean-like-predicates-as-constraints-in-dry-types/1807 "2024-07-03T18:19:40Z")

</div>

When specifying a schema using dry-validations, I can do something like this to check for a particular type of UUID: required(:uuid).value(:string, :uuid\_v4?) This is invoking the uuid\_v4? predicate provided by dry-log…

---

## [specify initialize method dry-initializer](https://discourse.dry-rb.org/t/specify-initialize-method-dry-initializer/1802)

<div class="topic-metadata">

**Author:** [@scottbarrow](https://discourse.dry-rb.org/u/scottbarrow)\
**Replies:** 0\
**Last updated:** [May 29, 2024, 9:25pm UTC](https://discourse.dry-rb.org/t/specify-initialize-method-dry-initializer/1802 "2024-05-29T21:25:20Z")

</div>

Is there a way to define the name of the initialize method that dry-initializer interacts with. E.g. for use with Classes that have wrappers around constructors such as ActiveJobs, Sidekiq jobs, #perform method

---

## [dry-logger API compatible with Ruby logger?](https://discourse.dry-rb.org/t/dry-logger-api-compatible-with-ruby-logger/1590)

<div class="topic-metadata">

**Author:** [@masterT](https://discourse.dry-rb.org/u/masterT)\
**Replies:** 3\
**Last updated:** [May 14, 2024, 5:10pm UTC](https://discourse.dry-rb.org/t/dry-logger-api-compatible-with-ruby-logger/1590 "2024-05-14T17:10:06Z")

</div>

It would be helpful if the dry-logger API would be compatible with the standard Ruby Logger API so that it can be used in other libraries. I think the only thing missing is to support block passed to the logging methods…

---

## [Define a Hash param that also accepts a String that is validates \*then\* parsed](https://discourse.dry-rb.org/t/define-a-hash-param-that-also-accepts-a-string-that-is-validates-then-parsed/1799)

<div class="topic-metadata">

**Author:** [@postmodern](https://discourse.dry-rb.org/u/postmodern)\
**Replies:** 1\
**Last updated:** [May 10, 2024, 5:18pm UTC](https://discourse.dry-rb.org/t/define-a-hash-param-that-also-accepts-a-string-that-is-validates-then-parsed/1799 "2024-05-10T17:18:55Z")

</div>

I’m wondering how one would define a Hash param (ex: for HTTP headers) that accepts a String, which is first validated using a Regex, then parsed into a Hash. I know about dry-types .constructor and dry-validations’s bef…

---

## [Dynamic schema with Configurable's option/param](https://discourse.dry-rb.org/t/dynamic-schema-with-configurables-option-param/1800)

<div class="topic-metadata">

**Author:** [@freesteph](https://discourse.dry-rb.org/u/freesteph)\
**Replies:** 0\
**Last updated:** [May 9, 2024, 11:00am UTC](https://discourse.dry-rb.org/t/dynamic-schema-with-configurables-option-param/1800 "2024-05-09T11:00:27Z")

</div>

Hello, I’ve been scratching my head for a couple hours but I can’t figure out how to do this: require "dry-validation" class MySchema \< Dry::Validation::Contract option :sizes, default: -\> { %w\[small medium large\] }…

---

## [How do I use a macro with an optional property?](https://discourse.dry-rb.org/t/how-do-i-use-a-macro-with-an-optional-property/822)

<div class="topic-metadata">

**Author:** [@shepmaster](https://discourse.dry-rb.org/u/shepmaster)\
**Replies:** 15\
**Last updated:** [May 1, 2024, 6:35pm UTC](https://discourse.dry-rb.org/t/how-do-i-use-a-macro-with-an-optional-property/822 "2024-05-01T18:35:03Z")

</div>

I ran into enough troubles attempting to use dry-validation 0.13 that I’m looking at 1.0. Based on my understanding, predicates are gone and built-in tools like gt? are gone. It appears that the replacements are macros. …

---

## [Ability to apply rules to external schema](https://discourse.dry-rb.org/t/ability-to-apply-rules-to-external-schema/1020)

<div class="topic-metadata">

**Author:** [@otov](https://discourse.dry-rb.org/u/otov)\
**Replies:** 5\
**Last updated:** [April 15, 2020, 9:05am UTC](https://discourse.dry-rb.org/t/ability-to-apply-rules-to-external-schema/1020 "2020-04-15T09:05:17Z")

</div>

Is there a trick to making rules work when a rule path refers to a key in re-used schema? AddressSchema = Dry::Schema.Params do required(:country).value(:string) required(:zipcode).value(:string) required(:street)…

---

## [Alias container key names](https://discourse.dry-rb.org/t/alias-container-key-names/1792)

<div class="topic-metadata">

**Author:** [@dlinch](https://discourse.dry-rb.org/u/dlinch)\
**Replies:** 0\
**Last updated:** [April 16, 2024, 11:05pm UTC](https://discourse.dry-rb.org/t/alias-container-key-names/1792 "2024-04-16T23:05:44Z")

</div>

We are running into a scenario where several different key names would resolve to the same namespace. Specifically, we’re resolving different “flows” with different customers and their unique slugs are the container name…

[Previous page](https://discourse.dry-rb.org/latest.md)

[Next page](https://discourse.dry-rb.org/latest.md?page=2)
