foobara 0.6.4 → 0.6.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3417123e9edcf11d20e2d6355e1b63d7d25b33e957b42d32c64b4452d93f4463
4
- data.tar.gz: 8b94bd6c61857d89eda1bcf667a408536cad9f2a5845f9a51a57e931a64ae28c
3
+ metadata.gz: 8f7628f3975299e2c2d578d47b6ea01cf00d10d0c64566b01d307ae44d400cd6
4
+ data.tar.gz: 7e1964b48bea37ba9206c85d171c0c52985e9499131a3e96bcf661559730b4da
5
5
  SHA512:
6
- metadata.gz: b57004203dabc6e0d305f17dfd470e7fe47878b0c1be28fb6ebd89b5c0cbf943e96b5efa8404ce929e7a59744e0a36385649448391830886a5042ec3d48ce822
7
- data.tar.gz: 77d265ecf8b8c9f2fa8dcc30f996df4f237fda07eee821f7d85c67963ab42732a5dec786e2f0a2c6e273d1077215dac22ef4ad44c2ca8dc410e56658417ec599
6
+ metadata.gz: 8061eb55fbc5879d63532708009f9591f4c5c9766a6a282612b51fa8c48a80e537ad5f4e488150f57434cf50a621d4a0c687efcc0963508808470e00c5c0b76b
7
+ data.tar.gz: f593b3dcc25323a6253c928ed4d4735386e65c0cebf4e4ef6d219d8ac8dccfa253b1223aa85d227c66ffdf2c409a39d0ea8632ac90cc489ff8b529b9f41f8913
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # [0.6.5] - 2026-10-04
2
+
3
+ - Fix a problem where some nested sugary types don't expand correctly when using attributes dsl
4
+ - Add command name to error message when a result can't be cast to the result type
5
+
1
6
  # [0.6.4] - 2026-09-11
2
7
 
3
8
  - Track which models instances ignore unsupported attributes to prevent various issues, including breaking domain mappers
@@ -4,7 +4,15 @@ module Foobara
4
4
  module Result
5
5
  include Concern
6
6
 
7
- class CouldNotProcessResult < Outcome::UnsuccessfulOutcomeError; end
7
+ class CouldNotProcessResult < Outcome::UnsuccessfulOutcomeError;
8
+ attr_accessor :command
9
+
10
+ def initialize(command, errors)
11
+ self.command = command
12
+
13
+ super(errors, prefix: command.class.full_command_name)
14
+ end
15
+ end
8
16
 
9
17
  private
10
18
 
@@ -16,7 +24,7 @@ module Foobara
16
24
  if outcome.success?
17
25
  outcome.result
18
26
  else
19
- raise CouldNotProcessResult, outcome.errors
27
+ raise CouldNotProcessResult.new(self, outcome.errors)
20
28
  end
21
29
  end
22
30
  end
@@ -3,10 +3,12 @@ module Foobara
3
3
  class UnsuccessfulOutcomeError < StandardError
4
4
  attr_accessor :errors, :backtrace_when_raised
5
5
 
6
- def initialize(errors)
6
+ def initialize(errors, message: errors.map(&:message).join(", "), prefix: nil)
7
7
  self.errors = errors
8
8
 
9
- message = errors.map(&:message).join(", ")
9
+ if prefix
10
+ message = "#{prefix}: #{message}"
11
+ end
10
12
 
11
13
  super(message)
12
14
  end
@@ -83,6 +83,17 @@ module Foobara
83
83
  end
84
84
  end
85
85
 
86
+ if type && !type.is_a?(::Symbol)
87
+ type = Domain.current.foobara_type_from_declaration(type)
88
+
89
+ type = if type.registered?
90
+ type.reference_symbol
91
+ else
92
+ declaration = type.declaration_data.merge(declaration)
93
+ declaration[:type]
94
+ end
95
+ end
96
+
86
97
  processor_symbols.each do |processor_symbol|
87
98
  case processor_symbol
88
99
  when ::String
@@ -428,12 +428,7 @@ module Foobara
428
428
  remove_sensitive = TypeDeclarations.foobara_manifest_context_remove_sensitive?
429
429
 
430
430
  if registered?
431
- # TODO: we should just use the symbol and nothing else in this context instead of a hash with 1 element.
432
- if scoped_unregistered?
433
- unregistered_foobara_manifest_reference.to_sym
434
- else
435
- foobara_manifest_reference.to_sym
436
- end
431
+ reference_symbol
437
432
  elsif remove_sensitive
438
433
  TypeDeclarations.remove_sensitive_types(declaration_data)
439
434
  else
@@ -441,6 +436,16 @@ module Foobara
441
436
  end
442
437
  end
443
438
 
439
+ def reference_symbol
440
+ raise "Not registered so no reference symbol" unless registered?
441
+
442
+ if scoped_unregistered?
443
+ unregistered_foobara_manifest_reference.to_sym
444
+ else
445
+ foobara_manifest_reference.to_sym
446
+ end
447
+ end
448
+
444
449
  def declaration_data_for_manifest
445
450
  data = declaration_data
446
451
 
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Foobara
2
2
  module Version
3
- VERSION = "0.6.4".freeze
3
+ VERSION = "0.6.5".freeze
4
4
  MINIMUM_RUBY_VERSION = [">= 3.4.0", "< 4.1"].freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.4
4
+ version: 0.6.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi