An experimental TypeSpec syntax for Lexicon

draft: blue.zio (atfile) lexicons

+214
+17
packages/emitter/test/integration/lexicon-examples/input/blue/zio/atfile/finger.tsp
···
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace blue.zio.atfile.finger.defs { 4 + /** A fingerprint of a browser upload. */ 5 + model Browser { 6 + id?: string; 7 + userAgent?: string; 8 + } 9 + 10 + /** A fingerprint of a machine upload. */ 11 + model Machine { 12 + app?: string; 13 + host?: string; 14 + id?: string; 15 + os?: string; 16 + } 17 + }
+9
packages/emitter/test/integration/lexicon-examples/input/blue/zio/atfile/lock.tsp
···
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace blue.zio.atfile.lock { 4 + /** A reference to a locked file. */ 5 + @rec("any") 6 + model Main { 7 + lock?: boolean; 8 + } 9 + }
+8
packages/emitter/test/integration/lexicon-examples/input/blue/zio/atfile/meta.tsp
···
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace blue.zio.atfile.meta.defs { 4 + /** Unknown metadata for an uploaded file. */ 5 + model Unknown { 6 + reason?: string; 7 + } 8 + }
+40
packages/emitter/test/integration/lexicon-examples/input/blue/zio/atfile/upload.tsp
···
··· 1 + import "@typelex/emitter"; 2 + 3 + namespace blue.zio.atfile.upload { 4 + /** A reference to an uploaded blob. */ 5 + @rec("any") 6 + model Main { 7 + blob?: Blob<#["*/*"]>; 8 + 9 + checksum?: { 10 + algo?: string; 11 + hash?: string; 12 + }; 13 + 14 + createdAt?: datetime; 15 + 16 + file?: { 17 + mimeType?: string; 18 + modifiedAt?: datetime; 19 + name?: string; 20 + size?: integer; 21 + }; 22 + 23 + finger?: blue.zio.atfile.finger.defs.Browser | blue.zio.atfile.finger.defs.Machine | unknown; 24 + 25 + meta?: blue.zio.atfile.meta.defs.Unknown | unknown; 26 + } 27 + } 28 + 29 + // --- Externals --- 30 + 31 + @external 32 + namespace blue.zio.atfile.finger.defs { 33 + model Browser { } 34 + model Machine { } 35 + } 36 + 37 + @external 38 + namespace blue.zio.atfile.meta.defs { 39 + model Unknown { } 40 + }
+36
packages/emitter/test/integration/lexicon-examples/output/blue/zio/atfile/finger.json
···
··· 1 + { 2 + "lexicon": 1, 3 + "id": "blue.zio.atfile.finger", 4 + "defs": { 5 + "browser": { 6 + "type": "object", 7 + "description": "A fingerprint of a browser upload.", 8 + "properties": { 9 + "id": { 10 + "type": "string" 11 + }, 12 + "userAgent": { 13 + "type": "string" 14 + } 15 + } 16 + }, 17 + "machine": { 18 + "type": "object", 19 + "description": "A fingerprint of a machine upload.", 20 + "properties": { 21 + "app": { 22 + "type": "string" 23 + }, 24 + "host": { 25 + "type": "string" 26 + }, 27 + "id": { 28 + "type": "string" 29 + }, 30 + "os": { 31 + "type": "string" 32 + } 33 + } 34 + } 35 + } 36 + }
+20
packages/emitter/test/integration/lexicon-examples/output/blue/zio/atfile/lock.json
···
··· 1 + { 2 + "lexicon": 1, 3 + "id": "blue.zio.atfile.lock", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A reference to a locked file.", 8 + "key": "any", 9 + "record": { 10 + "type": "object", 11 + "properties": { 12 + "lock": { 13 + "type": "boolean" 14 + } 15 + } 16 + } 17 + } 18 + } 19 + } 20 +
+15
packages/emitter/test/integration/lexicon-examples/output/blue/zio/atfile/meta.json
···
··· 1 + { 2 + "lexicon": 1, 3 + "id": "blue.zio.atfile.meta", 4 + "defs": { 5 + "unknown": { 6 + "type": "object", 7 + "description": "Unknown metadata for an uploaded file.", 8 + "properties": { 9 + "reason": { 10 + "type": "string" 11 + } 12 + } 13 + } 14 + } 15 + }
+69
packages/emitter/test/integration/lexicon-examples/output/blue/zio/atfile/upload.json
···
··· 1 + { 2 + "lexicon": 1, 3 + "id": "blue.zio.atfile.upload", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "A reference to an uploaded blob.", 8 + "key": "any", 9 + "record": { 10 + "type": "object", 11 + "properties": { 12 + "blob": { 13 + "type": "blob", 14 + "accept": "*/*", 15 + "maxSize": 1000000000000 16 + }, 17 + "checksum": { 18 + "type": "object", 19 + "properties": { 20 + "algo": { 21 + "type": "string" 22 + }, 23 + "hash": { 24 + "type": "string" 25 + } 26 + } 27 + }, 28 + "createdAt": { 29 + "type": "string", 30 + "format": "datetime" 31 + }, 32 + "file": { 33 + "type": "object", 34 + "properties": { 35 + "mimeType": { 36 + "type": "string" 37 + }, 38 + "modifiedAt": { 39 + "type": "string", 40 + "format": "datetime" 41 + }, 42 + "name": { 43 + "type": "string" 44 + }, 45 + "size": { 46 + "type": "integer" 47 + } 48 + } 49 + }, 50 + "finger": { 51 + "type": "union", 52 + "refs": [ 53 + "blue.zio.atfile.finger#browser", 54 + "blue.zio.atfile.finger#machine" 55 + ], 56 + "closed": false 57 + }, 58 + "meta": { 59 + "type": "union", 60 + "refs": [ 61 + "blue.zio.atfile.meta#unknown" 62 + ], 63 + "closed": false 64 + } 65 + } 66 + } 67 + } 68 + } 69 + }