Skip to content

Commit 136cb27

Browse files
committed
Do not include Model/Entity classes in command inputs to simplify things for now
1 parent 867f44d commit 136cb27

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

Gemfile.lock

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
foobara-typescript-react-command-form-generator (0.0.11)
4+
foobara-typescript-react-command-form-generator (0.0.12)
55
foobara-typescript-remote-command-generator (~> 0.0.1)
66

77
GEM
@@ -13,11 +13,12 @@ GEM
1313
coderay (1.1.3)
1414
diff-lcs (1.6.1)
1515
docile (1.4.1)
16-
ffi (1.17.1-x86_64-linux-gnu)
17-
foobara (0.0.96)
16+
ffi (1.17.2-x86_64-linux-gnu)
17+
foobara (0.0.102)
1818
bigdecimal
1919
foobara-lru-cache (~> 0.0.2)
2020
foobara-util (~> 0.0.11)
21+
inheritable-thread-vars (~> 0.0.1)
2122
foobara-files-generator (0.0.5)
2223
foobara
2324
foobara-lru-cache (0.0.2)
@@ -26,8 +27,7 @@ GEM
2627
rubocop-rspec
2728
foobara-spec-helpers (0.0.4)
2829
foobara-util
29-
foobara-typescript-remote-command-generator (0.0.16)
30-
foobara (~> 0.0.88)
30+
foobara-typescript-remote-command-generator (0.0.18)
3131
foobara-files-generator (~> 0.0.1)
3232
foobara-util (0.0.11)
3333
formatador (1.1.0)
@@ -47,6 +47,7 @@ GEM
4747
guard (~> 2.1)
4848
guard-compat (~> 1.1)
4949
rspec (>= 2.99.0, < 4.0)
50+
inheritable-thread-vars (0.0.2)
5051
json (2.10.2)
5152
language_server-protocol (3.17.0.4)
5253
lint_roller (1.1.0)
@@ -61,8 +62,8 @@ GEM
6162
nenv (~> 0.1)
6263
shellany (~> 0.0)
6364
ostruct (0.6.1)
64-
parallel (1.26.3)
65-
parser (3.3.7.4)
65+
parallel (1.27.0)
66+
parser (3.3.8.0)
6667
ast (~> 2.4.1)
6768
racc
6869
prism (1.4.0)
@@ -106,7 +107,7 @@ GEM
106107
rubocop-ast (>= 1.44.0, < 2.0)
107108
ruby-progressbar (~> 1.7)
108109
unicode-display_width (>= 2.4.0, < 4.0)
109-
rubocop-ast (1.44.0)
110+
rubocop-ast (1.44.1)
110111
parser (>= 3.3.7.2)
111112
prism (~> 1.4)
112113
rubocop-rake (0.7.1)

src/typescript_react_command_form_generator.rb

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,16 @@ def type_generators(type_declaration = inputs_type, initial = true)
3636
return @type_generators if defined?(@type_generators)
3737

3838
generators = if type_declaration.entity?
39-
generator_class = RemoteGenerator::Services::UnloadedEntityGenerator
40-
[generator_class.new(type_declaration.to_entity)]
39+
# For now, we'll not bother with entity/model classes in the inputs.
40+
# This simplifies things a bit re: form generation and setting UI
41+
# inputs into the inputs value.
42+
type_generators(type_declaration.to_type.primary_key_type, false)
43+
# generator_class = RemoteGenerator::Services::UnloadedEntityGenerator
44+
# [generator_class.new(type_declaration.to_entity)]
4145
elsif type_declaration.model?
42-
generator_class = RemoteGenerator::Services::AtomModelGenerator
43-
[generator_class.new(type_declaration.to_model)]
46+
type_generators(type_declaration.to_type.attributes_type, false)
47+
# generator_class = RemoteGenerator::Services::AtomModelGenerator
48+
# [generator_class.new(type_declaration.to_model)]
4449
elsif type_declaration.type.to_sym == :attributes
4550
type_declaration.attribute_declarations.values.map do |attribute_declaration|
4651
type_generators(attribute_declaration, false)

templates/CommandForm.tsx.erb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { <%= command_name %> } from "<%= path_to_root %><%= command_generator.im
66
<% unless empty_inputs? %>
77
import <%= inputs_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Inputs"
88
<% end %>
9+
<%# TODO: why isn't the result type handled via dependency_roots to avoid collisions with other types? %>
910
import <%= result_class_name %> from "<%= path_to_root %><%= command_generator.import_path %>/Result"
1011
import { Error as <%= error_class_name %> } from "<%= path_to_root %><%= command_generator.import_path %>/Errors"
1112

0 commit comments

Comments
 (0)