foobara 0.0.47 → 0.0.48

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b307418792bdb9ffc486a5f7280d67838100daac32a7826277612121612304a9
4
- data.tar.gz: e6e6c541731cadc39c9c64c9f759c3d347e291fa9731351d33248d9b27ec8de5
3
+ metadata.gz: 7c661c32185af433ba2355ce71bf37524893d00901a6e885ab5bd874339e48b6
4
+ data.tar.gz: 8ab10b8b9191bc81548d07269ca8c4906515164aa87a702ac7b944170e2420a7
5
5
  SHA512:
6
- metadata.gz: d76ba08fc4bc43e51a3c99ec9a780da84e57e9b15d6b29b1782e916ace9adbc198f6e1723852232e4c04766a5979c367bdc1dae6ec020ec3d5d742c61bb4a667
7
- data.tar.gz: 95a5ae616494aa957e57e465700a7330b1224bf2d4bb43482f5c13e35a5cabfa63b74e239492136a0e1d75f44c578b0b9a02abc7de64a0cadfd8053769de9341
6
+ metadata.gz: 3aaff8aa022ea5cf95ab300430576fbf08d813ccd2344630b035bf54372826fda4de76e5b7d9937e70278fcc7b0c23973d4499be25ad1531401b8b82004c153a
7
+ data.tar.gz: ffbc1887647b08588f218798cb99ab27af30ece05d4540926cb521a429c3dc9a4d992163802528f9f3a8022a52558e5158ee4b5b13dbe297a2e6036393ec49dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## [0.0.48] - 2025-01-17
2
+
3
+ - Add support for foobara_attributes_type to allow ActiveRecordType gem to work
4
+
1
5
  ## [0.0.47] - 2025-01-03
2
6
 
3
7
  - Bumped Ruby from 3.2.2 to 3.4.1
@@ -91,7 +91,7 @@ module Foobara
91
91
 
92
92
  error_class = self.class.lookup_input_error_class(symbol, path)
93
93
  error_class.new(**error_args, path:)
94
- elsif args.size == 2 || args.size == 3
94
+ elsif [2, 3].include?(args.size)
95
95
  input, symbol, message = args
96
96
  context = opts
97
97
 
@@ -143,7 +143,7 @@ module Foobara
143
143
 
144
144
  error_class = self.class.lookup_runtime_error_class(symbol)
145
145
  error_class.new(**error_args)
146
- elsif args.is_a?(::Array) && (args.size == 1 || args.size == 2)
146
+ elsif args.is_a?(::Array) && [1, 2].include?(args.size)
147
147
  symbol, message = args
148
148
  context = opts
149
149
 
@@ -2,6 +2,8 @@ module Foobara
2
2
  class Command
3
3
  module Concerns
4
4
  module Inputs
5
+ class UnexpectedInputValidationError < StandardError; end
6
+
5
7
  include Concern
6
8
 
7
9
  attr_reader :inputs
@@ -41,9 +43,8 @@ module Foobara
41
43
  if error.is_a?(Value::DataError)
42
44
  add_input_error(error)
43
45
  else
44
- # TODO: raise a real error
45
46
  # :nocov:
46
- raise "wtf"
47
+ raise UnexpectedInputValidationError, "Unexpected input validation error: #{error}"
47
48
  # :nocov:
48
49
  end
49
50
  end
@@ -109,6 +109,8 @@ module Foobara
109
109
  end
110
110
  end
111
111
 
112
+ # TODO: this big switch is a problem. Hard to create new types in other projects without being able
113
+ # to modify this switch. Figure out what to do.
112
114
  def construct_associations(
113
115
  type = attributes_type,
114
116
  path = DataPath.new,
@@ -135,7 +137,12 @@ module Foobara
135
137
  construct_associations(element_type, path.append(attribute_name), result)
136
138
  end
137
139
  elsif type.extends?(BuiltinTypes[:model])
138
- construct_associations(type.target_class.attributes_type, path, result)
140
+ target_class = type.target_class
141
+
142
+ method = target_class.respond_to?(:foobara_attributes_type) ? :foobara_attributes_type : :attributes_type
143
+ attributes_type = target_class.send(method)
144
+
145
+ construct_associations(attributes_type, path, result)
139
146
  elsif type.extends?(BuiltinTypes[:associative_array])
140
147
  # not going to bother testing this for now
141
148
  # :nocov:
@@ -53,7 +53,7 @@ module Foobara
53
53
  end
54
54
 
55
55
  def model?
56
- return false if reference == "entity" || reference == "detached_entity"
56
+ return false if %w[entity detached_entity].include?(reference)
57
57
 
58
58
  type = base_type
59
59
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: foobara
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.47
4
+ version: 0.0.48
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miles Georgi
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-04 00:00:00.000000000 Z
10
+ date: 2025-01-18 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: bigdecimal