Skip to content

Commit

Permalink
Merge new-model-changes feature branch to main (#171)
Browse files Browse the repository at this point in the history
* Adds new model changes for `Structure` (#138)
* Adds new model changes for scalar (#143)
* Adds changes for sequence data type (#144)
* Adds tests for new model changes (#146)
* Adds new model changes for Rust code generation (#147)
* Adds changes for optional/required fields in Java code generation (#148)
* Modifies generated setter API to take nested types instead of nested properties (#153)
* Adds support for builder API generation in Java (#154)
* Adds support for Java enum generation (#158)
* Adds namespace fix for nested sequence and adds support for nested types in Sequence and Scalar ADT (#163)
* Adds changes for nested type naming (#166)
* Adds support for imports in code generation (#169)
  • Loading branch information
desaikd authored Nov 1, 2024
1 parent 1953628 commit 7509ba9
Show file tree
Hide file tree
Showing 74 changed files with 2,497 additions and 1,629 deletions.
12 changes: 11 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ thiserror = "1.0.50"
zstd = "0.13.0"
termcolor = "1.4.1"
derive_builder = "0.20.0"
itertools = "0.13.0"

[target.'cfg(not(target_os = "windows"))'.dependencies]
pager = "0.16.1"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FoobarBaz // expected FooBarBaz, found FoobarBaz
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
hello // expected (foo, bar, baz or FooBarBaz) found hello
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"foo" // expected a symbol value foo for enum, found string "foo"
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
D: false,
E: (1 2 3) // expected list
}
}
}
2 changes: 1 addition & 1 deletion code-gen-projects/input/bad/scalar/mismatched_type.ion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
12 // expected string
12 // expected string

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[1, 2, 3] // expected list of strings
Original file line number Diff line number Diff line change
@@ -1 +1 @@
("foo" "bar" "baz") // expected list
("foo" "bar" "baz") // expected list
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[foobar] // expected values are either foo , bar or baz, found foobar.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ mango ] // expected apple, banana or strawberry, found mango
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
(apple banana) // expected list, found sexp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
{
A: "hello",
B: 12,
C: (1 2 3),
C: (1 2 3), // expected sexpression of strings
D: 10e2
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// simple struct with type mismatched sequence type
{
A: "hello",
B: 12,
C: ["foo", "bar", "baz"], // expected sexp
D: 10e2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// simple struct with type mismatched fields
{
A: "hello",
B: false, // expected field type: int
C: ("foo" "bar" "baz"),
D: 10e2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// simple struct with all valid fields
{
A: "hello",
B: 12,
// C: ("foo" "bar" "baz"), // since `C` is a required field, this is an invalid struct
D: 10e2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// struct with mismatched sequence element
{
A: "hello",
B: 12,
C: (1 2 3), // expected sexpression of strings
D: 10e2
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,3 @@
C: ("foo" "bar" "baz"),
D: 10e2
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// simple struct with all valid fields
{
A: "hello",
B: 12,
// C: ("foo" "bar" "baz"), // since `C` is a required field, this is an invalid struct
D: 10e2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// simple struct with type mismatched import field
{
A: "hello",
B: false, // expected field type symbol
}
1 change: 1 addition & 0 deletions code-gen-projects/input/good/enum_type/valid_value_1.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
foo
1 change: 1 addition & 0 deletions code-gen-projects/input/good/enum_type/valid_value_2.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bar
1 change: 1 addition & 0 deletions code-gen-projects/input/good/enum_type/valid_value_3.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
baz
1 change: 1 addition & 0 deletions code-gen-projects/input/good/enum_type/valid_value_4.ion
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FooBarBaz
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// nested struct with some optional fields that are not provided
{
A: "hello",
// B: 12, // since `B` is optional field, this is a valid struct
C: {
D: false,
E: [1, 2, 3]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@
E: [1, 2, 3]
}
}

2 changes: 1 addition & 1 deletion code-gen-projects/input/good/scalar/empty_value.ion
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// empty string
""
""
2 changes: 1 addition & 1 deletion code-gen-projects/input/good/scalar/valid_value.ion
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
// a scalar value of string type
"Hello World!"
"Hello World!"
2 changes: 1 addition & 1 deletion code-gen-projects/input/good/sequence/empty_sequence.ion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[]
[]
2 changes: 1 addition & 1 deletion code-gen-projects/input/good/sequence/valid_elements.ion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
["foo", "bar", "baz"]
["foo", "bar", "baz"]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[foo, bar, baz]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[]
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ apple, strawberry ]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// struct with empty list, empty string and zeros
{
C: (),
A: "",
B: 0,
D: 0e0,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// simple struct with all valid fields
{
A: "hello",
B: 12,
C: ("foo" "bar" "baz"),
D: 10e2,
E: foo
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// simple struct with all valid fields
{
A: "hello",
B: 12,
C: ("foo" "bar" "baz"),
// D: 10e2, // since `D` is optional field, this is a valid struct
E: foo,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
// struct with unordered fields
{
C: ("foo" "bar" "baz"),
A: "hello",
B: 12,
E: foo,
D: 10e2,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// simple struct with all valid fields
{
A: "hello",
B: 12,
C: ("foo" "bar" "baz"),
// D: 10e2, // since `D` is optional field, this is a valid struct
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

// struct with unordered fields
{
C: ("foo" "bar" "baz"),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// simple struct with all valid fields
{
A: "hello",
B: apple,
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// simple struct with all valid fields
{
A: "hello",
// B: apple, // since `B` is an optional field, this is a valid struct
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
// struct with unordered fields
{
B: banana,
A: "hello",
}
Loading

0 comments on commit 7509ba9

Please sign in to comment.