-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
34 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
// GenOpts: --skip-gen4tests | ||
|
||
#@define | ||
User = { | ||
name: string | ||
age: integer | ||
} | ||
|
||
# A map of users | ||
users : { "[string]" : User } | ||
|
||
# A map with inlined object as value type | ||
#@optional | ||
otherMap : { | ||
"[string]" : { | ||
foo: string | ||
baz: integer | ||
} | ||
} | ||
|
||
# Map related invalid cases: | ||
# (1) multiple map defining keys are not allowed | ||
# (2) no other fields allowed when a map is defined | ||
# (3) Only `string` is allowed as key type (other types may be supported in the future) | ||
# (4) Map defining key at first level is not allowed | ||
|
||
otherMap2 : { | ||
"[string]" : { foo: string } # OK | ||
# "[String]" : int # (1) | ||
# otherStuff: string # (2) | ||
# "[int]" : string # (3) | ||
} | ||
|
||
# "[string]" : long # (4) |