An experimental TypeSpec syntax for Lexicon
56
fork

Configure Feed

Select the types of activity you want to include in your feed.

moar

+998 -1
+4
packages/emitter/src/emitter.ts
··· 1011 1011 case "Union": 1012 1012 return this.handleUnionType(type as Union, prop, isDefining, propDesc); 1013 1013 case "Intrinsic": 1014 + const intrinsicType = type as IntrinsicType; 1015 + if (intrinsicType.name === "null") { 1016 + return { type: "null" as const, description: propDesc }; 1017 + } 1014 1018 return { type: "unknown" as const, description: propDesc }; 1015 1019 default: 1016 1020 // Unhandled type kind
+6 -1
packages/emitter/src/types.ts
··· 7 7 */ 8 8 9 9 // Primitives 10 + export type LexNull = { 11 + type: "null"; 12 + description?: string; 13 + }; 14 + 10 15 export type LexBoolean = { 11 16 type: "boolean"; 12 17 description?: string; ··· 43 48 description?: string; 44 49 }; 45 50 46 - export type LexPrimitive = LexBoolean | LexInteger | LexString | LexUnknown; 51 + export type LexPrimitive = LexNull | LexBoolean | LexInteger | LexString | LexUnknown; 47 52 48 53 // IPLD types 49 54 export type LexBytes = {
+12
packages/emitter/test/spec/basic/input/com/example/allOptionalFields.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.allOptionalFields { 4 + @doc("Object with all optional fields (no required)") 5 + model Main { 6 + @doc("All fields are optional") 7 + field1?: string; 8 + 9 + field2?: integer; 10 + field3?: boolean; 11 + } 12 + }
+52
packages/emitter/test/spec/basic/input/com/example/arrayOfUnions.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.arrayOfUnions { 4 + model Main { 5 + @doc("Array of open union variants") 6 + @required 7 + items: (ItemA | ItemB | ItemC | unknown)[]; 8 + 9 + @doc("Array of closed union variants") 10 + @maxItems(10) 11 + operations?: Operations[]; 12 + } 13 + 14 + model ItemA { 15 + @required type: string; 16 + @required valueA: string; 17 + } 18 + 19 + model ItemB { 20 + @required type: string; 21 + @required valueB: integer; 22 + } 23 + 24 + model ItemC { 25 + @required type: string; 26 + @required valueC: boolean; 27 + } 28 + 29 + @closed 30 + @inline 31 + union Operations { 32 + Create, 33 + Update, 34 + Delete, 35 + } 36 + 37 + model Create { 38 + @required action: string; 39 + @required data: string; 40 + } 41 + 42 + model Update { 43 + @required action: string; 44 + @required id: string; 45 + @required data: string; 46 + } 47 + 48 + model Delete { 49 + @required action: string; 50 + @required id: string; 51 + } 52 + }
+33
packages/emitter/test/spec/basic/input/com/example/constValues.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.constValues { 4 + @doc("Tests const values on all supported types") 5 + model Main { 6 + @doc("Constant string value") 7 + @readOnly 8 + @required 9 + stringConst: string = "fixed-value"; 10 + 11 + @doc("Constant boolean value (true)") 12 + @readOnly 13 + @required 14 + boolConst: boolean = true; 15 + 16 + @doc("Constant boolean value (false)") 17 + @readOnly 18 + falseConst?: boolean = false; 19 + 20 + @doc("Constant integer value") 21 + @readOnly 22 + @required 23 + intConst: integer = 42; 24 + 25 + @doc("Constant zero") 26 + @readOnly 27 + zeroConst?: integer = 0; 28 + 29 + @doc("Constant negative integer") 30 + @readOnly 31 + negativeConst?: integer = -100; 32 + } 33 + }
+32
packages/emitter/test/spec/basic/input/com/example/deeplyNested.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.deeplyNested { 4 + @doc("Tests deeply nested object structures") 5 + model Main { 6 + @doc("Three levels of nesting") 7 + @required 8 + level1: Level1; 9 + } 10 + 11 + model Level1 { 12 + @required name: string; 13 + @required level2: Level2; 14 + } 15 + 16 + model Level2 { 17 + @required id: integer; 18 + level3?: Level3; 19 + } 20 + 21 + model Level3 { 22 + @required data: string; 23 + 24 + @doc("Nullable field at deep level") 25 + metadata?: Metadata | null; 26 + } 27 + 28 + model Metadata { 29 + @required key: string; 30 + value?: string; 31 + } 32 + }
+61
packages/emitter/test/spec/basic/input/com/example/nestedUnions.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.nestedUnions { 4 + @doc("Tests unions nested within objects and arrays") 5 + model Main { 6 + @doc("Object containing a union field") 7 + @required 8 + container: Container; 9 + 10 + @doc("Array of objects that contain unions") 11 + items?: Item[]; 12 + } 13 + 14 + model Container { 15 + @required id: string; 16 + 17 + @doc("Nested union within object") 18 + @required 19 + payload: (PayloadA | PayloadB | unknown); 20 + 21 + @doc("Nullable ref within object") 22 + metadata?: MetadataPublic | null; 23 + } 24 + 25 + model Item { 26 + @required name: string; 27 + 28 + @doc("Union in nested object") 29 + content?: (TextContent | ImageContent | VideoContent | unknown); 30 + } 31 + 32 + model PayloadA { 33 + @required type: string; 34 + @required dataA: string; 35 + } 36 + 37 + model PayloadB { 38 + @required type: string; 39 + @required dataB: integer; 40 + } 41 + 42 + model MetadataPublic { 43 + @required visibility: string; 44 + @required key: string; 45 + } 46 + 47 + model TextContent { 48 + @required contentType: string; 49 + @required text: string; 50 + } 51 + 52 + model ImageContent { 53 + @required contentType: string; 54 + @required imageUrl: uri; 55 + } 56 + 57 + model VideoContent { 58 + @required contentType: string; 59 + @required videoUrl: uri; 60 + } 61 + }
+16
packages/emitter/test/spec/basic/input/com/example/nullType.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.nullType { 4 + @doc("Demonstrates the null primitive type") 5 + model Main { 6 + @doc("Field with explicit null type - always null") 7 + @required 8 + alwaysNull: null; 9 + 10 + @doc("Optional field that can be string or omitted, but not null") 11 + optionalString?: string; 12 + 13 + @doc("Nullable string - can be omitted, string, or null") 14 + nullableString?: string | null; 15 + } 16 + }
+22
packages/emitter/test/spec/basic/input/com/example/paramsWithArrays.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.paramsWithArrays { 4 + @doc("Tests query parameters with array types") 5 + @query 6 + op main( 7 + @doc("Array of string values") 8 + tags?: string[], 9 + 10 + @doc("Array of integers") 11 + @maxItems(10) 12 + ids?: integer[], 13 + 14 + @doc("Array of booleans") 15 + flags?: boolean[], 16 + 17 + @doc("Single string param for comparison") 18 + cursor?: string 19 + ): { 20 + @required count: integer; 21 + }; 22 + }
+32
packages/emitter/test/spec/basic/input/com/example/procedureWithBoth.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.procedureWithBoth { 4 + @doc("Procedure with both input body and query parameters") 5 + @procedure 6 + op main( 7 + input: { 8 + @doc("Data to create") 9 + @required 10 + data: string; 11 + 12 + @doc("Optional metadata") 13 + metadata?: Metadata; 14 + }, 15 + parameters: { 16 + @doc("Whether to validate before creating") 17 + validate?: boolean = true; 18 + 19 + @doc("Target repository") 20 + @required 21 + repo: atIdentifier; 22 + } 23 + ): { 24 + @required id: string; 25 + @required success: boolean; 26 + }; 27 + 28 + model Metadata { 29 + @required key: string; 30 + value?: string; 31 + } 32 + }
+14
packages/emitter/test/spec/basic/input/com/example/recordWithNsidKey.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.recordWithNsidKey { 4 + @rec("nsid") 5 + @doc("Record with NSID as the record key") 6 + model Main { 7 + @doc("The NSID of the associated lexicon") 8 + @required 9 + nsid: nsid; 10 + 11 + @doc("Optional metadata") 12 + metadata?: string; 13 + } 14 + }
+33
packages/emitter/test/spec/basic/input/com/example/subscriptionWithErrors.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.subscriptionWithErrors { 4 + @doc("Subscription with error definitions") 5 + @subscription 6 + @errors(ConsumerTooSlow, InvalidCursor) 7 + op main( 8 + @doc("Optional cursor for resuming") 9 + cursor?: integer 10 + ): (Event | Status | Info); 11 + 12 + model Event { 13 + @required seq: integer; 14 + @required type: string; 15 + @required data: string; 16 + } 17 + 18 + model Status { 19 + @required seq: integer; 20 + @required active: boolean; 21 + } 22 + 23 + model Info { 24 + @required name: string; 25 + message?: string; 26 + } 27 + 28 + @doc("Indicates the consumer is not keeping up with the event stream") 29 + model ConsumerTooSlow {} 30 + 31 + @doc("The provided cursor is invalid or expired") 32 + model InvalidCursor {} 33 + }
+22
packages/emitter/test/spec/basic/input/com/example/unionWithTokens.tsp
··· 1 + import "@tylex/emitter"; 2 + 3 + namespace com.example.unionWithTokens { 4 + @doc("Tests union with token references") 5 + model Main { 6 + @doc("Reason can be a known token or unknown type") 7 + @required 8 + reason: (ReasonSpam | ReasonViolation | ReasonMisleading | unknown); 9 + } 10 + 11 + @doc("Spam: frequent unwanted promotion") 12 + @token 13 + model ReasonSpam {} 14 + 15 + @doc("Direct violation of rules") 16 + @token 17 + model ReasonViolation {} 18 + 19 + @doc("Misleading or deceptive content") 20 + @token 21 + model ReasonMisleading {} 22 + }
+22
packages/emitter/test/spec/basic/output/com/example/allOptionalFields.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.allOptionalFields", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Object with all optional fields (no required)", 8 + "properties": { 9 + "field1": { 10 + "type": "string", 11 + "description": "All fields are optional" 12 + }, 13 + "field2": { 14 + "type": "integer" 15 + }, 16 + "field3": { 17 + "type": "boolean" 18 + } 19 + } 20 + } 21 + } 22 + }
+105
packages/emitter/test/spec/basic/output/com/example/arrayOfUnions.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.arrayOfUnions", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "required": ["items"], 8 + "properties": { 9 + "items": { 10 + "type": "array", 11 + "description": "Array of open union variants", 12 + "items": { 13 + "type": "union", 14 + "refs": ["#itemA", "#itemB", "#itemC"] 15 + } 16 + }, 17 + "operations": { 18 + "type": "array", 19 + "description": "Array of closed union variants", 20 + "maxLength": 10, 21 + "items": { 22 + "type": "union", 23 + "closed": true, 24 + "refs": ["#create", "#update", "#delete"] 25 + } 26 + } 27 + } 28 + }, 29 + "itemA": { 30 + "type": "object", 31 + "required": ["type", "valueA"], 32 + "properties": { 33 + "type": { 34 + "type": "string" 35 + }, 36 + "valueA": { 37 + "type": "string" 38 + } 39 + } 40 + }, 41 + "itemB": { 42 + "type": "object", 43 + "required": ["type", "valueB"], 44 + "properties": { 45 + "type": { 46 + "type": "string" 47 + }, 48 + "valueB": { 49 + "type": "integer" 50 + } 51 + } 52 + }, 53 + "itemC": { 54 + "type": "object", 55 + "required": ["type", "valueC"], 56 + "properties": { 57 + "type": { 58 + "type": "string" 59 + }, 60 + "valueC": { 61 + "type": "boolean" 62 + } 63 + } 64 + }, 65 + "create": { 66 + "type": "object", 67 + "required": ["action", "data"], 68 + "properties": { 69 + "action": { 70 + "type": "string" 71 + }, 72 + "data": { 73 + "type": "string" 74 + } 75 + } 76 + }, 77 + "update": { 78 + "type": "object", 79 + "required": ["action", "id", "data"], 80 + "properties": { 81 + "action": { 82 + "type": "string" 83 + }, 84 + "id": { 85 + "type": "string" 86 + }, 87 + "data": { 88 + "type": "string" 89 + } 90 + } 91 + }, 92 + "delete": { 93 + "type": "object", 94 + "required": ["action", "id"], 95 + "properties": { 96 + "action": { 97 + "type": "string" 98 + }, 99 + "id": { 100 + "type": "string" 101 + } 102 + } 103 + } 104 + } 105 + }
+43
packages/emitter/test/spec/basic/output/com/example/constValues.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.constValues", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Tests const values on all supported types", 8 + "required": ["stringConst", "boolConst", "intConst"], 9 + "properties": { 10 + "stringConst": { 11 + "type": "string", 12 + "description": "Constant string value", 13 + "const": "fixed-value" 14 + }, 15 + "boolConst": { 16 + "type": "boolean", 17 + "description": "Constant boolean value (true)", 18 + "const": true 19 + }, 20 + "falseConst": { 21 + "type": "boolean", 22 + "description": "Constant boolean value (false)", 23 + "const": false 24 + }, 25 + "intConst": { 26 + "type": "integer", 27 + "description": "Constant integer value", 28 + "const": 42 29 + }, 30 + "zeroConst": { 31 + "type": "integer", 32 + "description": "Constant zero", 33 + "const": 0 34 + }, 35 + "negativeConst": { 36 + "type": "integer", 37 + "description": "Constant negative integer", 38 + "const": -100 39 + } 40 + } 41 + } 42 + } 43 + }
+71
packages/emitter/test/spec/basic/output/com/example/deeplyNested.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.deeplyNested", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Tests deeply nested object structures", 8 + "required": ["level1"], 9 + "properties": { 10 + "level1": { 11 + "type": "ref", 12 + "ref": "#level1", 13 + "description": "Three levels of nesting" 14 + } 15 + } 16 + }, 17 + "level1": { 18 + "type": "object", 19 + "required": ["name", "level2"], 20 + "properties": { 21 + "name": { 22 + "type": "string" 23 + }, 24 + "level2": { 25 + "type": "ref", 26 + "ref": "#level2" 27 + } 28 + } 29 + }, 30 + "level2": { 31 + "type": "object", 32 + "required": ["id"], 33 + "properties": { 34 + "id": { 35 + "type": "integer" 36 + }, 37 + "level3": { 38 + "type": "ref", 39 + "ref": "#level3" 40 + } 41 + } 42 + }, 43 + "level3": { 44 + "type": "object", 45 + "required": ["data"], 46 + "nullable": ["metadata"], 47 + "properties": { 48 + "data": { 49 + "type": "string" 50 + }, 51 + "metadata": { 52 + "type": "ref", 53 + "ref": "#metadata", 54 + "description": "Nullable field at deep level" 55 + } 56 + } 57 + }, 58 + "metadata": { 59 + "type": "object", 60 + "required": ["key"], 61 + "properties": { 62 + "key": { 63 + "type": "string" 64 + }, 65 + "value": { 66 + "type": "string" 67 + } 68 + } 69 + } 70 + } 71 + }
+134
packages/emitter/test/spec/basic/output/com/example/nestedUnions.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.nestedUnions", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Tests unions nested within objects and arrays", 8 + "required": ["container"], 9 + "properties": { 10 + "container": { 11 + "type": "ref", 12 + "ref": "#container", 13 + "description": "Object containing a union field" 14 + }, 15 + "items": { 16 + "type": "array", 17 + "description": "Array of objects that contain unions", 18 + "items": { 19 + "type": "ref", 20 + "ref": "#item" 21 + } 22 + } 23 + } 24 + }, 25 + "container": { 26 + "type": "object", 27 + "required": ["id", "payload"], 28 + "nullable": ["metadata"], 29 + "properties": { 30 + "id": { 31 + "type": "string" 32 + }, 33 + "payload": { 34 + "type": "union", 35 + "description": "Nested union within object", 36 + "refs": ["#payloadA", "#payloadB"] 37 + }, 38 + "metadata": { 39 + "type": "ref", 40 + "ref": "#metadataPublic", 41 + "description": "Nullable ref within object" 42 + } 43 + } 44 + }, 45 + "item": { 46 + "type": "object", 47 + "required": ["name"], 48 + "properties": { 49 + "name": { 50 + "type": "string" 51 + }, 52 + "content": { 53 + "type": "union", 54 + "description": "Union in nested object", 55 + "refs": ["#textContent", "#imageContent", "#videoContent"] 56 + } 57 + } 58 + }, 59 + "payloadA": { 60 + "type": "object", 61 + "required": ["type", "dataA"], 62 + "properties": { 63 + "type": { 64 + "type": "string" 65 + }, 66 + "dataA": { 67 + "type": "string" 68 + } 69 + } 70 + }, 71 + "payloadB": { 72 + "type": "object", 73 + "required": ["type", "dataB"], 74 + "properties": { 75 + "type": { 76 + "type": "string" 77 + }, 78 + "dataB": { 79 + "type": "integer" 80 + } 81 + } 82 + }, 83 + "metadataPublic": { 84 + "type": "object", 85 + "required": ["visibility", "key"], 86 + "properties": { 87 + "visibility": { 88 + "type": "string" 89 + }, 90 + "key": { 91 + "type": "string" 92 + } 93 + } 94 + }, 95 + "textContent": { 96 + "type": "object", 97 + "required": ["contentType", "text"], 98 + "properties": { 99 + "contentType": { 100 + "type": "string" 101 + }, 102 + "text": { 103 + "type": "string" 104 + } 105 + } 106 + }, 107 + "imageContent": { 108 + "type": "object", 109 + "required": ["contentType", "imageUrl"], 110 + "properties": { 111 + "contentType": { 112 + "type": "string" 113 + }, 114 + "imageUrl": { 115 + "type": "string", 116 + "format": "uri" 117 + } 118 + } 119 + }, 120 + "videoContent": { 121 + "type": "object", 122 + "required": ["contentType", "videoUrl"], 123 + "properties": { 124 + "contentType": { 125 + "type": "string" 126 + }, 127 + "videoUrl": { 128 + "type": "string", 129 + "format": "uri" 130 + } 131 + } 132 + } 133 + } 134 + }
+26
packages/emitter/test/spec/basic/output/com/example/nullType.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.nullType", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Demonstrates the null primitive type", 8 + "required": ["alwaysNull"], 9 + "nullable": ["nullableString"], 10 + "properties": { 11 + "alwaysNull": { 12 + "type": "null", 13 + "description": "Field with explicit null type - always null" 14 + }, 15 + "optionalString": { 16 + "type": "string", 17 + "description": "Optional field that can be string or omitted, but not null" 18 + }, 19 + "nullableString": { 20 + "type": "string", 21 + "description": "Nullable string - can be omitted, string, or null" 22 + } 23 + } 24 + } 25 + } 26 + }
+53
packages/emitter/test/spec/basic/output/com/example/paramsWithArrays.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.paramsWithArrays", 4 + "defs": { 5 + "main": { 6 + "type": "query", 7 + "description": "Tests query parameters with array types", 8 + "parameters": { 9 + "type": "params", 10 + "properties": { 11 + "tags": { 12 + "type": "array", 13 + "description": "Array of string values", 14 + "items": { 15 + "type": "string" 16 + } 17 + }, 18 + "ids": { 19 + "type": "array", 20 + "description": "Array of integers", 21 + "maxLength": 10, 22 + "items": { 23 + "type": "integer" 24 + } 25 + }, 26 + "flags": { 27 + "type": "array", 28 + "description": "Array of booleans", 29 + "items": { 30 + "type": "boolean" 31 + } 32 + }, 33 + "cursor": { 34 + "type": "string", 35 + "description": "Single string param for comparison" 36 + } 37 + } 38 + }, 39 + "output": { 40 + "encoding": "application/json", 41 + "schema": { 42 + "type": "object", 43 + "required": ["count"], 44 + "properties": { 45 + "count": { 46 + "type": "integer" 47 + } 48 + } 49 + } 50 + } 51 + } 52 + } 53 + }
+71
packages/emitter/test/spec/basic/output/com/example/procedureWithBoth.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.procedureWithBoth", 4 + "defs": { 5 + "main": { 6 + "type": "procedure", 7 + "description": "Procedure with both input body and query parameters", 8 + "input": { 9 + "encoding": "application/json", 10 + "schema": { 11 + "type": "object", 12 + "required": ["data"], 13 + "properties": { 14 + "data": { 15 + "type": "string", 16 + "description": "Data to create" 17 + }, 18 + "metadata": { 19 + "type": "ref", 20 + "ref": "#metadata", 21 + "description": "Optional metadata" 22 + } 23 + } 24 + } 25 + }, 26 + "parameters": { 27 + "type": "params", 28 + "required": ["repo"], 29 + "properties": { 30 + "validate": { 31 + "type": "boolean", 32 + "description": "Whether to validate before creating", 33 + "default": true 34 + }, 35 + "repo": { 36 + "type": "string", 37 + "format": "at-identifier", 38 + "description": "Target repository" 39 + } 40 + } 41 + }, 42 + "output": { 43 + "encoding": "application/json", 44 + "schema": { 45 + "type": "object", 46 + "required": ["id", "success"], 47 + "properties": { 48 + "id": { 49 + "type": "string" 50 + }, 51 + "success": { 52 + "type": "boolean" 53 + } 54 + } 55 + } 56 + } 57 + }, 58 + "metadata": { 59 + "type": "object", 60 + "required": ["key"], 61 + "properties": { 62 + "key": { 63 + "type": "string" 64 + }, 65 + "value": { 66 + "type": "string" 67 + } 68 + } 69 + } 70 + } 71 + }
+26
packages/emitter/test/spec/basic/output/com/example/recordWithNsidKey.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.recordWithNsidKey", 4 + "defs": { 5 + "main": { 6 + "type": "record", 7 + "description": "Record with NSID as the record key", 8 + "key": "nsid", 9 + "record": { 10 + "type": "object", 11 + "required": ["nsid"], 12 + "properties": { 13 + "nsid": { 14 + "type": "string", 15 + "format": "nsid", 16 + "description": "The NSID of the associated lexicon" 17 + }, 18 + "metadata": { 19 + "type": "string", 20 + "description": "Optional metadata" 21 + } 22 + } 23 + } 24 + } 25 + } 26 + }
+74
packages/emitter/test/spec/basic/output/com/example/subscriptionWithErrors.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.subscriptionWithErrors", 4 + "defs": { 5 + "main": { 6 + "type": "subscription", 7 + "description": "Subscription with error definitions", 8 + "parameters": { 9 + "type": "params", 10 + "properties": { 11 + "cursor": { 12 + "type": "integer", 13 + "description": "Optional cursor for resuming" 14 + } 15 + } 16 + }, 17 + "message": { 18 + "schema": { 19 + "type": "union", 20 + "refs": ["#event", "#status", "#info"] 21 + } 22 + }, 23 + "errors": [ 24 + { 25 + "name": "ConsumerTooSlow", 26 + "description": "Indicates the consumer is not keeping up with the event stream" 27 + }, 28 + { 29 + "name": "InvalidCursor", 30 + "description": "The provided cursor is invalid or expired" 31 + } 32 + ] 33 + }, 34 + "event": { 35 + "type": "object", 36 + "required": ["seq", "type", "data"], 37 + "properties": { 38 + "seq": { 39 + "type": "integer" 40 + }, 41 + "type": { 42 + "type": "string" 43 + }, 44 + "data": { 45 + "type": "string" 46 + } 47 + } 48 + }, 49 + "status": { 50 + "type": "object", 51 + "required": ["seq", "active"], 52 + "properties": { 53 + "seq": { 54 + "type": "integer" 55 + }, 56 + "active": { 57 + "type": "boolean" 58 + } 59 + } 60 + }, 61 + "info": { 62 + "type": "object", 63 + "required": ["name"], 64 + "properties": { 65 + "name": { 66 + "type": "string" 67 + }, 68 + "message": { 69 + "type": "string" 70 + } 71 + } 72 + } 73 + } 74 + }
+34
packages/emitter/test/spec/basic/output/com/example/unionWithTokens.json
··· 1 + { 2 + "lexicon": 1, 3 + "id": "com.example.unionWithTokens", 4 + "defs": { 5 + "main": { 6 + "type": "object", 7 + "description": "Tests union with token references", 8 + "required": ["reason"], 9 + "properties": { 10 + "reason": { 11 + "type": "union", 12 + "description": "Reason can be a known token or unknown type", 13 + "refs": [ 14 + "#reasonSpam", 15 + "#reasonViolation", 16 + "#reasonMisleading" 17 + ] 18 + } 19 + } 20 + }, 21 + "reasonSpam": { 22 + "type": "token", 23 + "description": "Spam: frequent unwanted promotion" 24 + }, 25 + "reasonViolation": { 26 + "type": "token", 27 + "description": "Direct violation of rules" 28 + }, 29 + "reasonMisleading": { 30 + "type": "token", 31 + "description": "Misleading or deceptive content" 32 + } 33 + } 34 + }