Community Lexicon has a lexicon like this (paraphrased):
{
"lexicon": 1,
"id": "community.lexicon.calendar.event",
"defs": {
"mode": {
"type": "string",
"description": "The mode of the event.",
"default": "community.lexicon.calendar.event#inperson",
"knownValues": [
"community.lexicon.calendar.event#hybrid",
"community.lexicon.calendar.event#inperson",
"community.lexicon.calendar.event#virtual"
]
},
"virtual": {
"type": "token",
"description": "A virtual event that takes place online."
},
"inperson": {
"type": "token",
"description": "An in-person event that takes place offline."
},
"hybrid": {
"type": "token",
"description": "A hybrid event that takes place both online and offline."
}
}
}
This maps almost to:
/** The mode of the event. */
@closed @inline
union Mode {
Hybrid,
Inperson,
Virtual,
}
/** A virtual event that takes place online. */
@token
model Virtual {}
/** An in-person event that takes place offline. */
@token
model Inperson {}
/** A hybrid event that takes place both online and offline. */
@token
model Hybrid {}
But I'm struggling to think of how to represent the default value in typelex.
proposal: https://tangled.org/@danabra.mov/typelex/pulls/5