Reputation: 167
type JsonSchema record{|
string 'type;
json properties;
|};
type ArraySchema record{|
string 'type;
json items;
|};
Please check the above record types. In both records 'type
should be "object"
and "array"
respectively. However, according to the above definition, the user is able to put any string to those fields. How do we constrain this?
Upvotes: 0
Views: 27
Reputation: 167
type JsonSchema record{|
"object" 'type = "object";
json properties;
|};
type ArraySchema record{|
"array" 'type = "array";
json items;
|};
We can define the field using singleton type and add default value as shown here.
Upvotes: 0