foobara 0.0.46 → 0.0.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -2
- data/projects/command/src/concerns/errors.rb +2 -2
- data/projects/command/src/concerns/inputs.rb +3 -2
- data/projects/detached_entity/src/concerns/associations.rb +8 -1
- data/projects/detached_entity/src/extensions/type_declarations/handlers/extend_detached_entity_type_declaration/primary_key_desugarizer.rb +2 -4
- data/projects/manifest/src/foobara/manifest/type.rb +1 -1
- data/projects/model/src/extensions/type_declarations/handlers/extend_model_type_declaration/attributes_handler_desugarizer.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7c661c32185af433ba2355ce71bf37524893d00901a6e885ab5bd874339e48b6
|
4
|
+
data.tar.gz: 8ab10b8b9191bc81548d07269ca8c4906515164aa87a702ac7b944170e2420a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3aaff8aa022ea5cf95ab300430576fbf08d813ccd2344630b035bf54372826fda4de76e5b7d9937e70278fcc7b0c23973d4499be25ad1531401b8b82004c153a
|
7
|
+
data.tar.gz: ffbc1887647b08588f218798cb99ab27af30ece05d4540926cb521a429c3dc9a4d992163802528f9f3a8022a52558e5158ee4b5b13dbe297a2e6036393ec49dd
|
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,11 @@
|
|
1
|
-
## [0.0.
|
1
|
+
## [0.0.48] - 2025-01-17
|
2
|
+
|
3
|
+
- Add support for foobara_attributes_type to allow ActiveRecordType gem to work
|
4
|
+
|
5
|
+
## [0.0.47] - 2025-01-03
|
2
6
|
|
3
7
|
- Bumped Ruby from 3.2.2 to 3.4.1
|
4
8
|
- Allow passing in a module when registering a "builtin" type
|
5
|
-
- Fix AttributesHandlerDesugarizer and PrimaryKeyDesugarizer bugs
|
6
9
|
|
7
10
|
## [0.0.42] - 2024-12-23
|
8
11
|
|
@@ -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
|
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) &&
|
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 "
|
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
|
-
|
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:
|
@@ -4,11 +4,9 @@ module Foobara
|
|
4
4
|
class ExtendDetachedEntityTypeDeclaration < ExtendModelTypeDeclaration
|
5
5
|
class PrimaryKeyDesugarizer < Desugarizer
|
6
6
|
def applicable?(sugary_type_declaration)
|
7
|
-
|
8
|
-
primary_key = sugary_type_declaration[:primary_key]
|
7
|
+
primary_key = sugary_type_declaration[:primary_key]
|
9
8
|
|
10
|
-
|
11
|
-
end
|
9
|
+
primary_key.is_a?(::String)
|
12
10
|
end
|
13
11
|
|
14
12
|
def desugarize(sugary_type_declaration)
|
@@ -4,7 +4,7 @@ module Foobara
|
|
4
4
|
class ExtendModelTypeDeclaration < ExtendRegisteredTypeDeclaration
|
5
5
|
class AttributesHandlerDesugarizer < TypeDeclarations::Desugarizer
|
6
6
|
def applicable?(sugary_type_declaration)
|
7
|
-
sugary_type_declaration
|
7
|
+
sugary_type_declaration[:type] == expected_type_symbol
|
8
8
|
end
|
9
9
|
|
10
10
|
def expected_type_symbol
|
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.
|
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-
|
10
|
+
date: 2025-01-18 00:00:00.000000000 Z
|
11
11
|
dependencies:
|
12
12
|
- !ruby/object:Gem::Dependency
|
13
13
|
name: bigdecimal
|