An experimental TypeSpec syntax for Lexicon

momre

+6 -2
+6 -2
DOCS.md
··· 72 72 73 73 ## Top-Level Lexicon Types 74 74 75 + In TypeSpec, top-level definitions are called [Models](https://typespec.io/docs/language-basics/models/). So you'll see `model Foo { }` used for almost everything, but with different decorators that make its purpose more conrete. 76 + 75 77 ### Record 76 78 77 79 ```typescript ··· 161 163 162 164 ## Inline vs Definitions 163 165 164 - **By default, models become separate defs.** Use `@inline` to prevent this: 166 + **By default, all TypeSpec `model`s become separate Lexicon `defs`.** Use `@inline` to prevent this: 165 167 166 168 ```typescript 167 169 // Without @inline - becomes separate def "statusEnum" ··· 182 184 183 185 ## Optional vs Required Fields 184 186 185 - **In lexicons, optional fields are the norm.** Required fields are discouraged and need explicit `@required`: 187 + **In lexicons, optional fields are the norm.** Required fields are discouraged and thus need explicit `@required`: 186 188 187 189 ```typescript 188 190 model Post { ··· 202 204 } 203 205 } 204 206 ``` 207 + 208 + (TypeSpec doesn't require this but I figured we want to make it extra hard to accidentally make a required field.) 205 209 206 210 ## Primitive Types 207 211