foobara 0.6.3 → 0.6.4

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: 936be6174137c2740ff9ba0bf5470251901aa9dc61bd841baf4af7dc0041e899
4
- data.tar.gz: fc49e694263c62adefef802dfa8e469aff130237ec815602cab0aaa92983a132
3
+ metadata.gz: 3417123e9edcf11d20e2d6355e1b63d7d25b33e957b42d32c64b4452d93f4463
4
+ data.tar.gz: 8b94bd6c61857d89eda1bcf667a408536cad9f2a5845f9a51a57e931a64ae28c
5
5
  SHA512:
6
- metadata.gz: bacfb096227c140aace0cd32ed77b1f436872936b07a346a2fac976b83b478a4d9babcb217454874e39c3c944cb664562edf777d863856f8e510bfbccea1105a
7
- data.tar.gz: 63d4cf117cadd2f5e6d9f5a8e220f28e1f726c5781578097899d9a7cda2f2727036d7354338bef46465452c44d36e4c0ddd878ec9c89a6ec976316240c2a452f
6
+ metadata.gz: b57004203dabc6e0d305f17dfd470e7fe47878b0c1be28fb6ebd89b5c0cbf943e96b5efa8404ce929e7a59744e0a36385649448391830886a5042ec3d48ce822
7
+ data.tar.gz: 77d265ecf8b8c9f2fa8dcc30f996df4f237fda07eee821f7d85c67963ab42732a5dec786e2f0a2c6e273d1077215dac22ef4ad44c2ca8dc410e56658417ec599
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 4.0.6
1
+ 4.0.7
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ # [0.6.4] - 2026-09-11
2
+
3
+ - Track which models instances ignore unsupported attributes to prevent various issues, including breaking domain mappers
4
+
1
5
  # [0.6.3] - 2026-09-11
2
6
 
3
7
  - Eliminate usage of removed JSON.fast_generate
@@ -0,0 +1,16 @@
1
+ require "foobara/builtin_types"
2
+ require "bigdecimal"
3
+
4
+ module Foobara
5
+ module BigDecimal
6
+ class << self
7
+ def install!
8
+ BuiltinTypes.build_and_register!(:big_decimal, BuiltinTypes[:number])
9
+ end
10
+
11
+ def reset_all = install!
12
+ end
13
+ end
14
+ end
15
+
16
+ Foobara.project("big_decimal", project_path: "#{__dir__}/../..")
@@ -2,8 +2,6 @@ require "foobara/type_declarations"
2
2
 
3
3
  require "date"
4
4
  require "time"
5
- # TODO: get this out of here
6
- require "bigdecimal"
7
5
 
8
6
  module Foobara
9
7
  # TODO: rename this to PrimitiveTypes and deprecate the name BuiltinTypes
@@ -46,7 +44,6 @@ module Foobara
46
44
  number = build_and_register!(:number, atomic_duck, ::Object)
47
45
  build_and_register!(:integer, number)
48
46
  build_and_register!(:float, number)
49
- build_and_register!(:big_decimal, number)
50
47
  # Let's skip these for now since they rarely come up in business contexts and both could be
51
48
  # represented by a tuple of numbers.
52
49
  # build_and_register!(:rational, number)
@@ -2,7 +2,6 @@ require "foobara/builtin_types"
2
2
 
3
3
  require "date"
4
4
  require "time"
5
- require "bigdecimal"
6
5
 
7
6
  module Foobara
8
7
  class Model
@@ -200,6 +200,10 @@ module Foobara
200
200
  end
201
201
  end
202
202
 
203
+ if Thread.inheritable_thread_local_var_get(:foobara_ignore_unexpected_attributes)
204
+ @ignore_unexpected_attributes = true
205
+ end
206
+
203
207
  validate = options[:validate]
204
208
 
205
209
  if attributes.nil?
@@ -241,6 +245,8 @@ module Foobara
241
245
  validate! if validate # TODO: test this code path
242
246
  end
243
247
 
248
+ def ignore_unexpected_attributes? = @ignore_unexpected_attributes
249
+
244
250
  def model_name
245
251
  self.class.model_name
246
252
  end
@@ -333,7 +339,16 @@ module Foobara
333
339
  end
334
340
 
335
341
  def validation_errors
336
- attributes_type.process_value(attributes).error_collection
342
+ errors = attributes_type.process_value(attributes).error_collection
343
+
344
+ unexpected_attributes_class =
345
+ BuiltinTypes::Attributes::SupportedProcessors::ElementTypeDeclarations::UnexpectedAttributesError
346
+
347
+ if ignore_unexpected_attributes?
348
+ errors.reject { unexpected_attributes_class === it }
349
+ else
350
+ errors
351
+ end
337
352
  end
338
353
 
339
354
  def validate!
@@ -46,6 +46,12 @@ module Foobara
46
46
  end
47
47
 
48
48
  def install!
49
+ # simplecov:disable
50
+ if is_installed
51
+ raise "Foobara.install! was already invoked"
52
+ end
53
+ # simplecov:enable
54
+
49
55
  self.is_installed = true
50
56
  all_projects.each_value(&:install!)
51
57
  end
@@ -57,7 +63,7 @@ module Foobara
57
63
 
58
64
  def raise_if_production!(method_name = nil)
59
65
  if method_name
60
- warn "DEPRECATION WARNING: Passing method_name is deprecated."
66
+ warn "DEPRECATION WARNING: Passing a method_name to Foobara.raise_if_production is deprecated."
61
67
  else
62
68
  method_name = caller_locations.map(&:label).find { |label| !label.start_with?("block in") }
63
69
  end
@@ -1,3 +1,5 @@
1
+ require "foobara/project"
2
+
1
3
  module Foobara
2
4
  module Types
3
5
  class << self
data/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Foobara
2
2
  module Version
3
- VERSION = "0.6.3".freeze
3
+ VERSION = "0.6.4".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.3
4
+ version: 0.6.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
@@ -80,6 +80,9 @@ files:
80
80
  - README.md
81
81
  - lib/foobara.rb
82
82
  - lib/foobara/all.rb
83
+ - projects/big_decimal/lib/foobara/big_decimal.rb
84
+ - projects/big_decimal/src/casters/integer.rb
85
+ - projects/big_decimal/src/casters/string.rb
83
86
  - projects/command/lib/foobara/command.rb
84
87
  - projects/command/src/command.rb
85
88
  - projects/command/src/command_pattern_implementation.rb
@@ -306,8 +309,6 @@ files:
306
309
  - projects/typesystem/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/array_of_symbols.rb
307
310
  - projects/typesystem/projects/builtin_types/src/attributes/supported_validators/required/type_declaration_extension/extend_attributes_type_declaration/type_declaration_validators/array_with_valid_attribute_names.rb
308
311
  - projects/typesystem/projects/builtin_types/src/attributes/transformers/remove_unexpected_attributes.rb
309
- - projects/typesystem/projects/builtin_types/src/big_decimal/casters/integer.rb
310
- - projects/typesystem/projects/builtin_types/src/big_decimal/casters/string.rb
311
312
  - projects/typesystem/projects/builtin_types/src/boolean/casters/numeric.rb
312
313
  - projects/typesystem/projects/builtin_types/src/boolean/casters/string_or_symbol.rb
313
314
  - projects/typesystem/projects/builtin_types/src/builtin_types.rb
@@ -555,6 +556,7 @@ require_paths:
555
556
  - projects/entities/projects/nested_transactionable/lib
556
557
  - projects/entities/projects/persistence/lib
557
558
  - projects/entities/projects/weak_object_set/lib
559
+ - projects/big_decimal/lib
558
560
  - projects/command/lib
559
561
  - projects/command_connectors/lib
560
562
  - projects/domain_mapper/lib
@@ -575,7 +577,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
575
577
  - !ruby/object:Gem::Version
576
578
  version: '0'
577
579
  requirements: []
578
- rubygems_version: 4.0.16
580
+ rubygems_version: 4.0.20
579
581
  specification_version: 4
580
582
  summary: A command-centric and discoverable software framework with a focus on domain
581
583
  concepts and abstracting away integration code