Skip to content

Commit

Permalink
Adds namespace fix for nested sequence and adds support for nested ty…
Browse files Browse the repository at this point in the history
…pes in Sequence and Scalar ADT (#163)

* Modified generator to fix bug for nested sequence namespace
* Modified `fully_qualified_type_ref` method to return `FullyQualifiedTypeReference`
Previously this returned `Option<FullyQualifiedTypeReference>`
* Modified templates for nested types in sequence
* Adds tests for nested enums
* Adds changes for using enum in namespace
* Adds `NamespaceNode` for `FullyQualifiedName`
  • Loading branch information
desaikd committed Nov 1, 2024
1 parent 116fe0a commit e521e17
Show file tree
Hide file tree
Showing 18 changed files with 287 additions and 133 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 @@
[foobar] // expected values are either foo , bar or baz, found foobar.
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
Expand Up @@ -137,6 +137,12 @@ void roundtripBadTestForEnumType() throws IOException {
runRoundtripBadTest("/bad/enum_type", EnumType::readFrom);
}


@Test
void roundtripBadTestForSequenceWithEnumElement() throws IOException {
runRoundtripBadTest("/bad/sequence_with_enum_element", SequenceWithEnumElement::readFrom);
}

private <T> void runRoundtripBadTest(String path, ReaderFunction<T> readerFunction) throws IOException {
File dir = new File(System.getenv("ION_INPUT") + path);
String[] fileNames = dir.list();
Expand Down Expand Up @@ -182,6 +188,11 @@ void roundtripGoodTestForEnumType() throws IOException {
runRoundtripGoodTest("/good/enum_type", EnumType::readFrom, (item, writer) -> item.writeTo(writer));
}

@Test
void roundtripGoodTestForSequenceWithEnumElement() throws IOException {
runRoundtripGoodTest("/good/sequence_with_enum_element", SequenceWithEnumElement::readFrom, (item, writer) -> item.writeTo(writer));
}

private <T> void runRoundtripGoodTest(String path, ReaderFunction<T> readerFunction, WriterFunction<T> writerFunction) throws IOException {
File dir = new File(System.getenv("ION_INPUT") + path);
String[] fileNames = dir.list();
Expand Down
5 changes: 5 additions & 0 deletions code-gen-projects/schema/sequence_with_enum_element.isl
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type::{
name: sequence_with_enum_element,
type: list,
element: { valid_values: [foo, bar, baz] }
}
Loading

0 comments on commit e521e17

Please sign in to comment.