-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: index sign key name reference in the schema body (#582)
* feat: impl index sign alias ref in the schema body * test: add more grammar test suites for schema index signature
- Loading branch information
Showing
10 changed files
with
146 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
schema TeamSpec[id: str]: | ||
fullName: str | ||
name = id | ||
shortName: str = name | ||
|
||
schema TeamMap: | ||
[n: str]: TeamSpec = TeamSpec(n) # `n` does not work currently | ||
|
||
teamMap = TeamMap { | ||
a.fullName = "alpha" | ||
b.fullName = "bravo" | ||
} |
9 changes: 9 additions & 0 deletions
9
test/grammar/schema/index_signature/key_alias_0/stdout.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
teamMap: | ||
b: | ||
fullName: bravo | ||
name: b | ||
shortName: b | ||
a: | ||
fullName: alpha | ||
name: a | ||
shortName: a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
schema TeamSpec: | ||
fullName: str | ||
name = id | ||
shortName: str = name | ||
|
||
schema TeamMap: | ||
[n: str]: TeamSpec = TeamSpec { | ||
name = n | ||
} | ||
|
||
teamMap = TeamMap { | ||
a.fullName = "alpha" | ||
b.fullName = "bravo" | ||
} |
9 changes: 9 additions & 0 deletions
9
test/grammar/schema/index_signature/key_alias_1/stdout.golden
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
teamMap: | ||
b: | ||
fullName: bravo | ||
name: b | ||
shortName: b | ||
a: | ||
fullName: alpha | ||
name: a | ||
shortName: a |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
schema LabelMap: | ||
[str]: str | int | ||
|
||
schema NamedMap: | ||
[str]: {str:str} = {"default_key": "default_value"} | ||
|
||
labelMap = LabelMap { | ||
key1 = "value1" | ||
key2 = 2 | ||
} | ||
|
||
namedMap = NamedMap { | ||
key1 = {key1 = "value1"} | ||
key2 = {key2 = "value2"} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
labelMap: | ||
key1: value1 | ||
key2: 2 | ||
namedMap: | ||
key1: | ||
key1: value1 | ||
key2: | ||
key2: value2 |