@cisco_open/linting-orchestrator 1.0.0-rc.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (197) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +5 -0
  3. package/README.md +43 -0
  4. package/build/cli/api-client.d.ts +170 -0
  5. package/build/cli/api-client.d.ts.map +1 -0
  6. package/build/cli/api-client.js +284 -0
  7. package/build/cli/api-client.js.map +1 -0
  8. package/build/cli/commands/agents.d.ts +7 -0
  9. package/build/cli/commands/agents.d.ts.map +1 -0
  10. package/build/cli/commands/agents.js +694 -0
  11. package/build/cli/commands/agents.js.map +1 -0
  12. package/build/cli/commands/completion.d.ts +9 -0
  13. package/build/cli/commands/completion.d.ts.map +1 -0
  14. package/build/cli/commands/completion.js +177 -0
  15. package/build/cli/commands/completion.js.map +1 -0
  16. package/build/cli/commands/config.d.ts +10 -0
  17. package/build/cli/commands/config.d.ts.map +1 -0
  18. package/build/cli/commands/config.js +284 -0
  19. package/build/cli/commands/config.js.map +1 -0
  20. package/build/cli/commands/health.d.ts +11 -0
  21. package/build/cli/commands/health.d.ts.map +1 -0
  22. package/build/cli/commands/health.js +38 -0
  23. package/build/cli/commands/health.js.map +1 -0
  24. package/build/cli/commands/help.d.ts +6 -0
  25. package/build/cli/commands/help.d.ts.map +1 -0
  26. package/build/cli/commands/help.js +20 -0
  27. package/build/cli/commands/help.js.map +1 -0
  28. package/build/cli/commands/history.d.ts +11 -0
  29. package/build/cli/commands/history.d.ts.map +1 -0
  30. package/build/cli/commands/history.js +50 -0
  31. package/build/cli/commands/history.js.map +1 -0
  32. package/build/cli/commands/jobs.d.ts +12 -0
  33. package/build/cli/commands/jobs.d.ts.map +1 -0
  34. package/build/cli/commands/jobs.js +84 -0
  35. package/build/cli/commands/jobs.js.map +1 -0
  36. package/build/cli/commands/lint.d.ts +15 -0
  37. package/build/cli/commands/lint.d.ts.map +1 -0
  38. package/build/cli/commands/lint.js +384 -0
  39. package/build/cli/commands/lint.js.map +1 -0
  40. package/build/cli/commands/ps.d.ts +8 -0
  41. package/build/cli/commands/ps.d.ts.map +1 -0
  42. package/build/cli/commands/ps.js +74 -0
  43. package/build/cli/commands/ps.js.map +1 -0
  44. package/build/cli/commands/reproduce.d.ts +9 -0
  45. package/build/cli/commands/reproduce.d.ts.map +1 -0
  46. package/build/cli/commands/reproduce.js +31 -0
  47. package/build/cli/commands/reproduce.js.map +1 -0
  48. package/build/cli/commands/reset.d.ts +5 -0
  49. package/build/cli/commands/reset.d.ts.map +1 -0
  50. package/build/cli/commands/reset.js +13 -0
  51. package/build/cli/commands/reset.js.map +1 -0
  52. package/build/cli/commands/results.d.ts +13 -0
  53. package/build/cli/commands/results.d.ts.map +1 -0
  54. package/build/cli/commands/results.js +129 -0
  55. package/build/cli/commands/results.js.map +1 -0
  56. package/build/cli/commands/rulesets/check.d.ts +12 -0
  57. package/build/cli/commands/rulesets/check.d.ts.map +1 -0
  58. package/build/cli/commands/rulesets/check.js +226 -0
  59. package/build/cli/commands/rulesets/check.js.map +1 -0
  60. package/build/cli/commands/rulesets/index.d.ts +5 -0
  61. package/build/cli/commands/rulesets/index.d.ts.map +1 -0
  62. package/build/cli/commands/rulesets/index.js +6 -0
  63. package/build/cli/commands/rulesets/index.js.map +1 -0
  64. package/build/cli/commands/rulesets/view.d.ts +16 -0
  65. package/build/cli/commands/rulesets/view.d.ts.map +1 -0
  66. package/build/cli/commands/rulesets/view.js +100 -0
  67. package/build/cli/commands/rulesets/view.js.map +1 -0
  68. package/build/cli/commands/start.d.ts +16 -0
  69. package/build/cli/commands/start.d.ts.map +1 -0
  70. package/build/cli/commands/start.js +167 -0
  71. package/build/cli/commands/start.js.map +1 -0
  72. package/build/cli/commands/status.d.ts +9 -0
  73. package/build/cli/commands/status.d.ts.map +1 -0
  74. package/build/cli/commands/status.js +46 -0
  75. package/build/cli/commands/status.js.map +1 -0
  76. package/build/cli/commands/stop.d.ts +11 -0
  77. package/build/cli/commands/stop.d.ts.map +1 -0
  78. package/build/cli/commands/stop.js +78 -0
  79. package/build/cli/commands/stop.js.map +1 -0
  80. package/build/cli/config-manager.d.ts +134 -0
  81. package/build/cli/config-manager.d.ts.map +1 -0
  82. package/build/cli/config-manager.js +288 -0
  83. package/build/cli/config-manager.js.map +1 -0
  84. package/build/cli/formatters.d.ts +62 -0
  85. package/build/cli/formatters.d.ts.map +1 -0
  86. package/build/cli/formatters.js +715 -0
  87. package/build/cli/formatters.js.map +1 -0
  88. package/build/cli/history-manager.d.ts +97 -0
  89. package/build/cli/history-manager.d.ts.map +1 -0
  90. package/build/cli/history-manager.js +201 -0
  91. package/build/cli/history-manager.js.map +1 -0
  92. package/build/cli/index.d.ts +16 -0
  93. package/build/cli/index.d.ts.map +1 -0
  94. package/build/cli/index.js +335 -0
  95. package/build/cli/index.js.map +1 -0
  96. package/build/cli/list-rulesets.d.ts +15 -0
  97. package/build/cli/list-rulesets.d.ts.map +1 -0
  98. package/build/cli/list-rulesets.js +193 -0
  99. package/build/cli/list-rulesets.js.map +1 -0
  100. package/build/cli/utils/connection-error.d.ts +9 -0
  101. package/build/cli/utils/connection-error.d.ts.map +1 -0
  102. package/build/cli/utils/connection-error.js +30 -0
  103. package/build/cli/utils/connection-error.js.map +1 -0
  104. package/build/cli/utils/embedded-server.d.ts +21 -0
  105. package/build/cli/utils/embedded-server.d.ts.map +1 -0
  106. package/build/cli/utils/embedded-server.js +61 -0
  107. package/build/cli/utils/embedded-server.js.map +1 -0
  108. package/build/cli/utils/mode-validator.d.ts +13 -0
  109. package/build/cli/utils/mode-validator.d.ts.map +1 -0
  110. package/build/cli/utils/mode-validator.js +31 -0
  111. package/build/cli/utils/mode-validator.js.map +1 -0
  112. package/build/cli/utils/port-checker.d.ts +20 -0
  113. package/build/cli/utils/port-checker.d.ts.map +1 -0
  114. package/build/cli/utils/port-checker.js +49 -0
  115. package/build/cli/utils/port-checker.js.map +1 -0
  116. package/build/config.d.ts +57 -0
  117. package/build/config.d.ts.map +1 -0
  118. package/build/config.js +527 -0
  119. package/build/config.js.map +1 -0
  120. package/build/document-accessor.d.ts +79 -0
  121. package/build/document-accessor.d.ts.map +1 -0
  122. package/build/document-accessor.js +148 -0
  123. package/build/document-accessor.js.map +1 -0
  124. package/build/formatters/reproduce-markdown.d.ts +14 -0
  125. package/build/formatters/reproduce-markdown.d.ts.map +1 -0
  126. package/build/formatters/reproduce-markdown.js +182 -0
  127. package/build/formatters/reproduce-markdown.js.map +1 -0
  128. package/build/formatters/sarif-builder.d.ts +86 -0
  129. package/build/formatters/sarif-builder.d.ts.map +1 -0
  130. package/build/formatters/sarif-builder.js +276 -0
  131. package/build/formatters/sarif-builder.js.map +1 -0
  132. package/build/index.d.ts +3 -0
  133. package/build/index.d.ts.map +1 -0
  134. package/build/index.js +174 -0
  135. package/build/index.js.map +1 -0
  136. package/build/logger.d.ts +38 -0
  137. package/build/logger.d.ts.map +1 -0
  138. package/build/logger.js +105 -0
  139. package/build/logger.js.map +1 -0
  140. package/build/mock-server.d.ts +2 -0
  141. package/build/mock-server.d.ts.map +1 -0
  142. package/build/mock-server.js +290 -0
  143. package/build/mock-server.js.map +1 -0
  144. package/build/orchestrator.d.ts +149 -0
  145. package/build/orchestrator.d.ts.map +1 -0
  146. package/build/orchestrator.js +874 -0
  147. package/build/orchestrator.js.map +1 -0
  148. package/build/ruleset-loader.d.ts +79 -0
  149. package/build/ruleset-loader.d.ts.map +1 -0
  150. package/build/ruleset-loader.js +514 -0
  151. package/build/ruleset-loader.js.map +1 -0
  152. package/build/schemas.d.ts +2568 -0
  153. package/build/schemas.d.ts.map +1 -0
  154. package/build/schemas.js +674 -0
  155. package/build/schemas.js.map +1 -0
  156. package/build/server.d.ts +39 -0
  157. package/build/server.d.ts.map +1 -0
  158. package/build/server.js +834 -0
  159. package/build/server.js.map +1 -0
  160. package/build/storage/memory-storage.d.ts +190 -0
  161. package/build/storage/memory-storage.d.ts.map +1 -0
  162. package/build/storage/memory-storage.js +629 -0
  163. package/build/storage/memory-storage.js.map +1 -0
  164. package/build/storage/redis-storage.d.ts +134 -0
  165. package/build/storage/redis-storage.d.ts.map +1 -0
  166. package/build/storage/redis-storage.js +236 -0
  167. package/build/storage/redis-storage.js.map +1 -0
  168. package/build/storage/storage-adapter.d.ts +189 -0
  169. package/build/storage/storage-adapter.d.ts.map +1 -0
  170. package/build/storage/storage-adapter.js +36 -0
  171. package/build/storage/storage-adapter.js.map +1 -0
  172. package/build/types.d.ts +981 -0
  173. package/build/types.d.ts.map +1 -0
  174. package/build/types.js +5 -0
  175. package/build/types.js.map +1 -0
  176. package/build/utils/version.d.ts +40 -0
  177. package/build/utils/version.d.ts.map +1 -0
  178. package/build/utils/version.js +94 -0
  179. package/build/utils/version.js.map +1 -0
  180. package/build/validation.d.ts +95 -0
  181. package/build/validation.d.ts.map +1 -0
  182. package/build/validation.js +150 -0
  183. package/build/validation.js.map +1 -0
  184. package/build/worker-pool.d.ts +137 -0
  185. package/build/worker-pool.d.ts.map +1 -0
  186. package/build/worker-pool.js +549 -0
  187. package/build/worker-pool.js.map +1 -0
  188. package/build/worker.d.ts +2 -0
  189. package/build/worker.d.ts.map +1 -0
  190. package/build/worker.js +427 -0
  191. package/build/worker.js.map +1 -0
  192. package/package.json +110 -0
  193. package/rulesets/CHANGELOG.md +25 -0
  194. package/rulesets/config/rulesets.yaml +96 -0
  195. package/rulesets/sources/README.md +47 -0
  196. package/rulesets/sources/example/oas-recommended/v1.0.0/ruleset.yaml +6 -0
  197. package/rulesets/sources/example/oas-recommended/v2.0.0/ruleset.yaml +14 -0
@@ -0,0 +1,674 @@
1
+ // Copyright 2026 Cisco Systems, Inc. and its affiliates
2
+ //
3
+ // SPDX-License-Identifier: Apache-2.0
4
+ /**
5
+ * OpenAPI/JSON Schema definitions for all orchestrator API responses.
6
+ *
7
+ * These schemas are consumed by @fastify/swagger to auto-generate the
8
+ * OpenAPI 3.0 specification from running code. They also double as
9
+ * Fastify response-validation schemas at runtime (opt-in).
10
+ *
11
+ * Naming convention: Schema* → reusable $ref building-blocks
12
+ * *Schema → full route-level response/request schemas
13
+ *
14
+ * @module schemas
15
+ */
16
+ // ============================================
17
+ // Shared / Reusable Schemas ($ref targets)
18
+ // ============================================
19
+ export const ErrorResponseSchema = {
20
+ $id: 'ErrorResponse',
21
+ type: 'object',
22
+ description: 'Standard error response returned by all endpoints on failure',
23
+ required: ['error', 'timestamp'],
24
+ properties: {
25
+ error: {
26
+ type: 'string',
27
+ description: 'Error category (e.g., Not Found, Validation Error, Internal Server Error)',
28
+ example: 'Not Found',
29
+ },
30
+ message: {
31
+ type: 'string',
32
+ description: 'Human-readable error message with context',
33
+ example: 'Document not found: abc-123',
34
+ },
35
+ details: {
36
+ type: 'object',
37
+ description: 'Additional error details such as validation errors or field-level issues',
38
+ additionalProperties: true,
39
+ },
40
+ timestamp: {
41
+ type: 'string',
42
+ format: 'date-time',
43
+ description: 'ISO 8601 timestamp when the error occurred',
44
+ example: '2026-03-05T12:00:00.000Z',
45
+ },
46
+ },
47
+ };
48
+ export const JobStatusSchema = {
49
+ $id: 'JobStatus',
50
+ type: 'string',
51
+ description: 'Lifecycle status of a lint job',
52
+ enum: [
53
+ 'queued',
54
+ 'running',
55
+ 'completed',
56
+ 'completed_with_errors',
57
+ 'failed',
58
+ 'timeout',
59
+ 'cancelled',
60
+ ],
61
+ example: 'completed',
62
+ };
63
+ export const JobProgressSchema = {
64
+ $id: 'JobProgress',
65
+ type: 'object',
66
+ description: 'Task-level progress breakdown for a lint job',
67
+ properties: {
68
+ totalTasks: { type: 'integer', description: 'Total number of tasks in the job', example: 1 },
69
+ completedTasks: { type: 'integer', description: 'Number of tasks that completed successfully', example: 1 },
70
+ failedTasks: { type: 'integer', description: 'Number of tasks that failed with errors', example: 0 },
71
+ timeoutTasks: { type: 'integer', description: 'Number of tasks that exceeded the execution timeout', example: 0 },
72
+ runningTasks: { type: 'integer', description: 'Number of tasks currently being executed', example: 0 },
73
+ queuedTasks: { type: 'integer', description: 'Number of tasks waiting in the queue', example: 0 },
74
+ },
75
+ };
76
+ export const SourcePositionSchema = {
77
+ $id: 'SourcePosition',
78
+ type: 'object',
79
+ description: 'A position in a text document identified by line and character offset',
80
+ properties: {
81
+ line: { type: 'integer', description: 'Zero-based line number in the source document', example: 62 },
82
+ character: { type: 'integer', description: 'Zero-based character offset within the line', example: 20 },
83
+ },
84
+ };
85
+ export const SourceRangeSchema = {
86
+ $id: 'SourceRange',
87
+ type: 'object',
88
+ description: 'Source location range within the document (line and character positions)',
89
+ properties: {
90
+ start: { $ref: 'SourcePosition#' },
91
+ end: { $ref: 'SourcePosition#' },
92
+ },
93
+ };
94
+ export const LintIssueSchema = {
95
+ $id: 'LintIssue',
96
+ type: 'object',
97
+ description: 'A single lint issue found in the document',
98
+ properties: {
99
+ ruleId: {
100
+ type: 'string',
101
+ description: 'Unique identifier of the rule that triggered this issue',
102
+ example: 'error-status-code',
103
+ },
104
+ code: {
105
+ type: 'string',
106
+ description: 'Machine-readable issue code from the ruleset',
107
+ example: 'error-status-code',
108
+ },
109
+ message: {
110
+ type: 'string',
111
+ description: 'Human-readable description of the issue',
112
+ example: 'responses should include at least one error status code (4xx or 5xx)',
113
+ },
114
+ severity: {
115
+ type: 'integer',
116
+ enum: [0, 1, 2, 3],
117
+ description: 'Severity level: 0=error, 1=warn, 2=info, 3=hint',
118
+ example: 1,
119
+ },
120
+ path: {
121
+ type: 'array',
122
+ description: 'JSONPath segments to the location of the issue in the document',
123
+ items: { oneOf: [{ type: 'string' }, { type: 'integer' }] },
124
+ example: ['paths', '/health', 'get', 'responses'],
125
+ },
126
+ range: { $ref: 'SourceRange#' },
127
+ suggestions: {
128
+ type: 'array',
129
+ description: 'Suggested fixes or improvements for the issue',
130
+ items: { type: 'string' },
131
+ example: ['Add a 4xx or 5xx response to this operation'],
132
+ },
133
+ },
134
+ };
135
+ export const ResultSummarySchema = {
136
+ $id: 'ResultSummary',
137
+ type: 'object',
138
+ description: 'Aggregated issue counts by severity level',
139
+ properties: {
140
+ totalIssues: { type: 'integer', description: 'Total number of issues found across all severity levels', example: 13 },
141
+ errorCount: { type: 'integer', description: 'Number of issues with error severity (must fix)', example: 5 },
142
+ warningCount: { type: 'integer', description: 'Number of issues with warning severity (should fix)', example: 8 },
143
+ infoCount: { type: 'integer', description: 'Number of informational issues', example: 0 },
144
+ hintCount: { type: 'integer', description: 'Number of hint-level suggestions', example: 0 },
145
+ },
146
+ };
147
+ export const RulesetExecutionResultSchema = {
148
+ $id: 'RulesetExecutionResult',
149
+ type: 'object',
150
+ description: 'Execution details for a single ruleset run against a document',
151
+ properties: {
152
+ rulesetName: { type: 'string', description: 'Name of the executed ruleset', example: 'pubhub' },
153
+ rulesetVersion: { type: 'string', description: 'Version of the executed ruleset', example: '1.1.0' },
154
+ executionTime: { type: 'number', description: 'Execution time in milliseconds for this ruleset', example: 277 },
155
+ success: { type: 'boolean', description: 'Whether the ruleset execution completed without internal errors', example: true },
156
+ error: { type: 'string', description: 'Error message if the ruleset execution failed internally', example: '' },
157
+ issueCount: { type: 'integer', description: 'Total number of issues found by this ruleset', example: 0 },
158
+ issues: {
159
+ type: 'array',
160
+ description: 'List of issues found by this ruleset',
161
+ items: { $ref: 'LintIssue#' },
162
+ },
163
+ metadata: {
164
+ type: 'object',
165
+ description: 'Execution metadata for this ruleset run',
166
+ properties: {
167
+ ruleEngine: { type: 'string', description: 'Name of the rule engine that executed the ruleset', example: 'spectral' },
168
+ documentId: { type: 'string', description: 'Identifier of the linted document', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
169
+ cacheHit: { type: 'boolean', description: 'Whether the result was served from cache', example: false },
170
+ },
171
+ },
172
+ },
173
+ };
174
+ export const RuleInfoSchema = {
175
+ $id: 'RuleInfo',
176
+ type: 'object',
177
+ description: 'Metadata for a single lint rule within a ruleset',
178
+ properties: {
179
+ name: { type: 'string', description: 'Unique rule identifier within the ruleset', example: 'operationId-required-and-unique' },
180
+ severity: { type: 'string', enum: ['error', 'warn', 'info', 'hint'], description: 'Default severity level of the rule', example: 'error' },
181
+ message: { type: 'string', description: 'Message template shown when the rule is triggered', example: 'Every operation must have a unique operationId' },
182
+ description: { type: 'string', description: 'Detailed explanation of what the rule checks and why', example: 'Ensures every operation has a unique operationId for code generation' },
183
+ recommended: { type: 'boolean', description: 'Whether this rule is recommended to be enabled', example: true },
184
+ },
185
+ };
186
+ export const DocumentSummarySchema = {
187
+ $id: 'DocumentSummary',
188
+ type: 'object',
189
+ description: 'Summary metadata for an uploaded document',
190
+ properties: {
191
+ documentId: { type: 'string', description: 'Unique document identifier', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
192
+ title: { type: 'string', description: 'Title from the document info section', example: 'My API' },
193
+ version: { type: 'string', description: 'API version from the document', example: '1.0.0' },
194
+ format: { type: 'string', description: 'Document format (json or yaml)', example: 'json' },
195
+ uploadedAt: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the document was uploaded', example: '2026-03-05T12:00:00.000Z' },
196
+ },
197
+ };
198
+ export const RuleOverridesSchema = {
199
+ $id: 'RuleOverrides',
200
+ type: 'object',
201
+ description: 'Map of rule IDs to override severity. Use "off" to exclude a rule, or a severity level to change it.',
202
+ additionalProperties: {
203
+ type: 'string',
204
+ enum: ['off', 'error', 'warn', 'info', 'hint'],
205
+ },
206
+ example: { 'operationId-required': 'off', 'error-status-code': 'warn' },
207
+ };
208
+ // ============================================
209
+ // Response Schemas (route-level)
210
+ // ============================================
211
+ export const HealthResponseSchema = {
212
+ $id: 'HealthResponse',
213
+ type: 'object',
214
+ description: 'Server health status including uptime, configuration, and runtime statistics',
215
+ properties: {
216
+ status: { type: 'string', enum: ['ok'], description: 'Server health status indicator', example: 'ok' },
217
+ version: { type: 'string', description: 'Orchestrator server version (semver)', example: '0.11.0' },
218
+ timestamp: { type: 'string', format: 'date-time', description: 'Current server time in ISO 8601 format', example: '2026-03-05T12:00:00.000Z' },
219
+ uptime: { type: 'integer', description: 'Server uptime in seconds since last start', example: 3600 },
220
+ mode: { type: 'string', enum: ['standalone', 'embedded', 'companion', 'mcp'], description: 'Current deployment mode of the server', example: 'standalone' },
221
+ server: {
222
+ type: 'object',
223
+ description: 'HTTP server configuration details',
224
+ properties: {
225
+ port: { type: 'integer', description: 'Port the server is listening on', example: 3003 },
226
+ host: { type: 'string', description: 'Host address the server is bound to', example: '0.0.0.0' },
227
+ startedAt: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the server started', example: '2026-03-05T11:00:00.000Z' },
228
+ },
229
+ },
230
+ documentStore: {
231
+ type: 'object',
232
+ description: 'Document storage backend configuration',
233
+ properties: {
234
+ type: { type: 'string', enum: ['local', 'passthrough'], description: 'Type of document store in use', example: 'local' },
235
+ baseDir: { type: 'string', description: 'Relative base directory for document storage', example: './uploads' },
236
+ fullPath: { type: 'string', description: 'Absolute resolved path to the document storage directory', example: '/home/user/spectify/uploads' },
237
+ },
238
+ },
239
+ stats: {
240
+ type: 'object',
241
+ description: 'Orchestrator runtime statistics snapshot (active jobs, worker counts, etc.)',
242
+ additionalProperties: true,
243
+ example: { activeJobs: 0, totalJobsProcessed: 42 },
244
+ },
245
+ runtime: {
246
+ type: 'object',
247
+ description: 'Runtime environment information (Node.js version, Spectral library versions, active resolver).',
248
+ properties: {
249
+ nodeVersion: { type: 'string', description: 'Node.js runtime version', example: 'v22.18.0' },
250
+ spectralCore: { type: 'string', description: 'Installed @stoplight/spectral-core version', example: '1.19.0' },
251
+ spectralRulesets: { type: 'string', description: 'Installed @stoplight/spectral-rulesets version', example: '1.22.0' },
252
+ spectralCli: { type: 'string', description: 'Installed @stoplight/spectral-cli version', example: '6.16.0' },
253
+ resolver: {
254
+ type: ['string', 'null'],
255
+ description: 'Active custom $ref resolver name, or null when using Spectral default resolver',
256
+ example: 'ignore-external-refs',
257
+ },
258
+ },
259
+ },
260
+ reportService: {
261
+ type: 'object',
262
+ description: 'Report Service connection status. Only present when configured.',
263
+ additionalProperties: true,
264
+ example: { connected: true, url: 'http://localhost:3010' },
265
+ },
266
+ },
267
+ };
268
+ export const DocumentUploadResponseSchema = {
269
+ $id: 'DocumentUploadResponse',
270
+ type: 'object',
271
+ description: 'Response after successfully uploading a document',
272
+ properties: {
273
+ documentId: { type: 'string', description: 'Unique identifier assigned to the uploaded document', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
274
+ version: { type: 'string', description: 'Version identifier of the stored document', example: '1' },
275
+ message: { type: 'string', description: 'Human-readable confirmation message', example: 'Document uploaded successfully' },
276
+ },
277
+ };
278
+ export const DocumentUploadRequestSchema = {
279
+ $id: 'DocumentUploadRequest',
280
+ type: 'object',
281
+ description: 'Request body for uploading a document',
282
+ required: ['content'],
283
+ properties: {
284
+ content: { type: 'string', description: 'Raw document content as a JSON or YAML string', example: '{"openapi":"3.0.0","info":{"title":"My API","version":"1.0"},"paths":{}}' },
285
+ format: { type: 'string', enum: ['json', 'yaml'], default: 'json', description: 'Format of the document content being uploaded', example: 'json' },
286
+ metadata: { type: 'object', description: 'Optional metadata to associate with the uploaded document', additionalProperties: true, example: { team: 'platform', tags: ['internal'] } },
287
+ },
288
+ };
289
+ export const DocumentListResponseSchema = {
290
+ $id: 'DocumentListResponse',
291
+ type: 'object',
292
+ description: 'Paginated list of uploaded documents with metadata',
293
+ properties: {
294
+ documents: {
295
+ type: 'array',
296
+ description: 'Array of document summary objects',
297
+ items: { $ref: 'DocumentSummary#' },
298
+ },
299
+ total: { type: 'integer', description: 'Total number of documents matching the query', example: 42 },
300
+ limit: { type: 'integer', description: 'Maximum number of results returned in this page', example: 50 },
301
+ offset: { type: 'integer', description: 'Number of results skipped for pagination', example: 0 },
302
+ },
303
+ };
304
+ export const DocumentResponseSchema = {
305
+ $id: 'DocumentResponse',
306
+ type: 'object',
307
+ description: 'Full document object including content and metadata',
308
+ properties: {
309
+ documentId: { type: 'string', description: 'Unique document identifier', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
310
+ content: { type: 'string', description: 'Raw document content as stored', example: '{"openapi":"3.0.0","info":{"title":"My API","version":"1.0"},"paths":{}}' },
311
+ format: { type: 'string', description: 'Document format (json or yaml)', example: 'json' },
312
+ metadata: { type: 'object', description: 'User-supplied metadata associated with the document', additionalProperties: true, example: { team: 'platform' } },
313
+ uploadedAt: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the document was uploaded', example: '2026-03-05T12:00:00.000Z' },
314
+ },
315
+ };
316
+ export const LintJobSubmitResponseSchema = {
317
+ $id: 'LintJobSubmitResponse',
318
+ type: 'object',
319
+ description: 'Response returned when a lint job is successfully queued',
320
+ properties: {
321
+ jobId: { type: 'string', format: 'uuid', description: 'Unique job identifier for tracking progress and retrieving results', example: '94c9db52-92fc-4733-806a-fe6d206109aa' },
322
+ status: { type: 'string', enum: ['queued'], description: 'Initial status of the newly created job', example: 'queued' },
323
+ message: { type: 'string', description: 'Human-readable confirmation message', example: 'Job submitted successfully' },
324
+ },
325
+ };
326
+ export const CapacityExceededResponseSchema = {
327
+ $id: 'CapacityExceededResponse',
328
+ type: 'object',
329
+ description: 'Response returned when the server cannot accept new jobs due to capacity limits',
330
+ properties: {
331
+ error: { type: 'string', description: 'Error type identifier', example: 'Too Many Requests' },
332
+ message: { type: 'string', description: 'Human-readable explanation of the capacity limit', example: 'Server at capacity with 50 active jobs (max 50)' },
333
+ activeJobs: { type: 'integer', description: 'Number of currently active (queued or running) jobs', example: 50 },
334
+ maxJobs: { type: 'integer', description: 'Maximum number of concurrent jobs the server allows', example: 50 },
335
+ retryAfter: { type: 'integer', description: 'Suggested number of seconds to wait before retrying', example: 5 },
336
+ },
337
+ };
338
+ export const LintJobStatusSchema = {
339
+ $id: 'LintJobStatus',
340
+ type: 'object',
341
+ description: 'Current status and progress of a lint job',
342
+ properties: {
343
+ jobId: { type: 'string', format: 'uuid', description: 'Unique job identifier', example: '94c9db52-92fc-4733-806a-fe6d206109aa' },
344
+ documentId: { type: 'string', description: 'Identifier of the document being linted', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
345
+ rulesetName: { type: 'string', description: 'Name of the ruleset used for linting', example: 'pubhub' },
346
+ rulesetVersion: { type: 'string', description: 'Version of the ruleset used for linting', example: '1.1.0' },
347
+ ruleOverrides: { $ref: 'RuleOverrides#' },
348
+ status: { $ref: 'JobStatus#' },
349
+ progress: { $ref: 'JobProgress#' },
350
+ startTime: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the job started processing', example: '2026-03-05T12:00:00.000Z' },
351
+ endTime: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the job finished', example: '2026-03-05T12:00:01.000Z' },
352
+ },
353
+ };
354
+ export const LintJobResultSchema = {
355
+ $id: 'LintJobResult',
356
+ type: 'object',
357
+ description: 'Complete results of a finished lint job including all issues and execution metadata',
358
+ properties: {
359
+ jobId: { type: 'string', format: 'uuid', description: 'Unique job identifier', example: '94c9db52-92fc-4733-806a-fe6d206109aa' },
360
+ documentId: { type: 'string', description: 'Identifier of the document that was linted', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
361
+ rulesetName: { type: 'string', description: 'Name of the ruleset used for linting', example: 'pubhub' },
362
+ rulesetVersion: { type: 'string', description: 'Version of the ruleset used for linting', example: '1.1.0' },
363
+ ruleOverrides: { $ref: 'RuleOverrides#' },
364
+ status: { $ref: 'JobStatus#' },
365
+ timestamp: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the job completed', example: '2026-03-05T12:00:01.000Z' },
366
+ totalExecutionTime: { type: 'number', description: 'Total execution time of the job in milliseconds', example: 321 },
367
+ summary: { $ref: 'ResultSummary#' },
368
+ results: {
369
+ type: 'array',
370
+ description: 'List of all lint issues found in the document',
371
+ items: { $ref: 'LintIssue#' },
372
+ },
373
+ executionDetails: { $ref: 'RulesetExecutionResult#' },
374
+ },
375
+ };
376
+ export const ReportGenerationRequestSchema = {
377
+ $id: 'ReportGenerationRequest',
378
+ type: 'object',
379
+ description: 'Request body to generate a report from a completed lint job',
380
+ required: ['format'],
381
+ properties: {
382
+ format: { type: 'string', enum: ['sarif'], description: 'Output format for the report. Currently only SARIF is supported.', example: 'sarif' },
383
+ options: {
384
+ type: 'object',
385
+ description: 'Optional report generation settings',
386
+ properties: {
387
+ includeSnippets: { type: 'boolean', description: 'Include source code snippets in the report for each issue', example: true },
388
+ fingerprintSchemes: { type: 'array', description: 'List of fingerprint scheme names to include for result deduplication', items: { type: 'string' }, example: ['v1'] },
389
+ },
390
+ },
391
+ },
392
+ };
393
+ export const SarifReportSchema = {
394
+ $id: 'SarifReport',
395
+ type: 'object',
396
+ description: 'SARIF v2.1.0 (Static Analysis Results Interchange Format) report',
397
+ properties: {
398
+ version: { type: 'string', description: 'SARIF format version', example: '2.1.0' },
399
+ $schema: { type: 'string', description: 'SARIF JSON schema URI', example: 'https://raw.githubusercontent.com/oasis-tcs/sarif-spec/main/sarif-2.1/schema/sarif-schema-2.1.0.json' },
400
+ runs: {
401
+ type: 'array',
402
+ description: 'Array of analysis runs. Each lint job produces one run.',
403
+ items: {
404
+ type: 'object',
405
+ description: 'A single SARIF analysis run containing tool info and results',
406
+ properties: {
407
+ tool: {
408
+ type: 'object',
409
+ description: 'Information about the analysis tool and its rules',
410
+ properties: {
411
+ driver: {
412
+ type: 'object',
413
+ description: 'The primary analysis tool driver',
414
+ properties: {
415
+ name: { type: 'string', description: 'Tool name', example: 'cisco-linting-orchestrator' },
416
+ version: { type: 'string', description: 'Tool version', example: '0.11.0' },
417
+ },
418
+ },
419
+ },
420
+ },
421
+ results: {
422
+ type: 'array',
423
+ description: 'Array of analysis results (issues found)',
424
+ items: {
425
+ type: 'object',
426
+ description: 'A single analysis result',
427
+ properties: {
428
+ ruleId: { type: 'string', description: 'Identifier of the rule that produced this result', example: 'error-status-code' },
429
+ message: {
430
+ type: 'object',
431
+ description: 'Message describing the result',
432
+ properties: {
433
+ text: { type: 'string', description: 'Plain text message', example: 'responses should include at least one error status code' },
434
+ },
435
+ },
436
+ },
437
+ },
438
+ },
439
+ },
440
+ },
441
+ },
442
+ },
443
+ };
444
+ export const JobSummarySchema = {
445
+ $id: 'JobSummary',
446
+ type: 'object',
447
+ description: 'Lightweight summary of a lint job for list views',
448
+ properties: {
449
+ jobId: { type: 'string', format: 'uuid', description: 'Unique job identifier', example: '94c9db52-92fc-4733-806a-fe6d206109aa' },
450
+ documentId: { type: 'string', description: 'Identifier of the linted document', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
451
+ rulesetName: { type: 'string', description: 'Name of the ruleset used for linting', example: 'pubhub' },
452
+ rulesetVersion: { type: 'string', description: 'Version of the ruleset used for linting', example: '1.1.0' },
453
+ status: { $ref: 'JobStatus#' },
454
+ timestamp: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the job completed', example: '2026-03-05T12:00:01.000Z' },
455
+ totalExecutionTime: { type: 'number', description: 'Total execution time in milliseconds', example: 321 },
456
+ summary: { $ref: 'ResultSummary#' },
457
+ },
458
+ };
459
+ export const JobListResponseSchema = {
460
+ $id: 'JobListResponse',
461
+ type: 'object',
462
+ description: 'Paginated list of lightweight job summaries',
463
+ properties: {
464
+ jobs: {
465
+ type: 'array',
466
+ description: 'Array of job summary objects',
467
+ items: { $ref: 'JobSummary#' },
468
+ },
469
+ pagination: {
470
+ type: 'object',
471
+ description: 'Pagination metadata',
472
+ properties: {
473
+ total: { type: 'integer', description: 'Total number of jobs matching the filter criteria', example: 10 },
474
+ limit: { type: 'integer', description: 'Maximum number of results returned in this page', example: 50 },
475
+ offset: { type: 'integer', description: 'Number of results skipped for pagination', example: 0 },
476
+ hasMore: { type: 'boolean', description: 'Whether more results are available beyond this page', example: false },
477
+ },
478
+ },
479
+ sessionId: { type: 'string', description: 'Runtime session ID used to filter stale jobs from previous server instances', example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' },
480
+ },
481
+ };
482
+ export const JobListDetailedResponseSchema = {
483
+ $id: 'JobListDetailedResponse',
484
+ type: 'object',
485
+ description: 'Paginated list of jobs with full document metadata attached',
486
+ properties: {
487
+ jobs: {
488
+ type: 'array',
489
+ description: 'Array of detailed job objects including document metadata',
490
+ items: {
491
+ type: 'object',
492
+ description: 'A job summary enriched with document metadata',
493
+ properties: {
494
+ jobId: { type: 'string', format: 'uuid', description: 'Unique job identifier', example: '94c9db52-92fc-4733-806a-fe6d206109aa' },
495
+ documentId: { type: 'string', description: 'Identifier of the linted document', example: '41c1d4aa-5825-4313-8ae5-737490707b5b' },
496
+ rulesetName: { type: 'string', description: 'Name of the ruleset used for linting', example: 'pubhub' },
497
+ rulesetVersion: { type: 'string', description: 'Version of the ruleset used for linting', example: '1.1.0' },
498
+ status: { $ref: 'JobStatus#' },
499
+ timestamp: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the job completed', example: '2026-03-05T12:00:01.000Z' },
500
+ totalExecutionTime: { type: 'number', description: 'Total execution time in milliseconds', example: 321 },
501
+ summary: { $ref: 'ResultSummary#' },
502
+ document: {
503
+ type: 'object',
504
+ description: 'Document metadata from the document store',
505
+ properties: {
506
+ documentId: { type: 'string', description: 'Document identifier' },
507
+ name: { type: 'string', description: 'Document name or filename', example: 'my-api.yaml' },
508
+ version: { type: 'string', description: 'version from the document', example: '1.0.0' },
509
+ organization: { type: 'string', description: 'Organization that owns the document' },
510
+ format: { type: 'string', enum: ['json', 'yaml'], description: 'Document format' },
511
+ operationCount: { type: 'integer', description: 'Number of operations in the document' },
512
+ size: { type: 'integer', description: 'Document size in bytes' },
513
+ },
514
+ },
515
+ },
516
+ },
517
+ },
518
+ pagination: {
519
+ type: 'object',
520
+ description: 'Pagination metadata',
521
+ properties: {
522
+ total: { type: 'integer', description: 'Total number of jobs matching the filter criteria', example: 10 },
523
+ limit: { type: 'integer', description: 'Maximum number of results returned in this page', example: 50 },
524
+ offset: { type: 'integer', description: 'Number of results skipped for pagination', example: 0 },
525
+ hasMore: { type: 'boolean', description: 'Whether more results are available beyond this page', example: false },
526
+ },
527
+ },
528
+ sessionId: { type: 'string', description: 'Runtime session ID used to filter stale jobs', example: 'a1b2c3d4-e5f6-7890-abcd-ef1234567890' },
529
+ },
530
+ };
531
+ export const CacheInvalidationResponseSchema = {
532
+ $id: 'CacheInvalidationResponse',
533
+ type: 'object',
534
+ description: 'Response confirming cache invalidation for a document',
535
+ properties: {
536
+ message: { type: 'string', description: 'Human-readable confirmation message', example: 'Cache invalidated for document: abc-123' },
537
+ },
538
+ };
539
+ export const RulesetSummarySchema = {
540
+ $id: 'RulesetSummary',
541
+ type: 'object',
542
+ description: 'Summary metadata for an available ruleset',
543
+ properties: {
544
+ name: { type: 'string', description: 'Unique ruleset identifier (kebab-case)', example: 'pubhub' },
545
+ version: { type: 'string', description: 'Default version of the ruleset', example: '1.1.0' },
546
+ defaultVersion: { type: 'string', description: 'Default version used when no version is specified', example: '1.1.0' },
547
+ description: { type: 'string', description: 'Brief description of what the ruleset validates', example: 'Validates documents for PubHub publishing readiness' },
548
+ availableVersions: { type: 'array', description: 'List of all available version identifiers for this ruleset', items: { type: 'string' }, example: ['1.0.0', '1.1.0'] },
549
+ displayName: { type: 'string', description: 'Human-friendly display name for the ruleset', example: 'PubHub Publishing Readiness' },
550
+ category: { type: 'string', enum: ['publishing', 'contract', 'security', 'documentation', 'validation', 'other'], description: 'Classification category of the ruleset', example: 'publishing' },
551
+ ruleCount: { type: 'integer', description: 'Number of rules in the default version of this ruleset', example: 60 },
552
+ tags: { type: 'array', description: 'Tags for filtering or grouping rulesets', items: { type: 'string' }, example: ['api-insights', 'documentation'] },
553
+ },
554
+ };
555
+ export const RulesetDetailsSchema = {
556
+ $id: 'RulesetDetails',
557
+ type: 'object',
558
+ description: 'Detailed information about a ruleset including all individual rules',
559
+ properties: {
560
+ name: { type: 'string', description: 'Unique ruleset identifier (kebab-case)', example: 'pubhub' },
561
+ displayName: { type: 'string', description: 'Human-friendly display name for the ruleset', example: 'PubHub Publishing Readiness' },
562
+ version: { type: 'string', description: 'Version of the loaded ruleset', example: '1.1.0' },
563
+ description: { type: 'string', description: 'Brief description of what the ruleset validates', example: 'Validates documents for PubHub publishing readiness' },
564
+ category: { type: 'string', enum: ['publishing', 'contract', 'security', 'documentation', 'validation', 'other'], description: 'Classification category', example: 'publishing' },
565
+ ruleCount: { type: 'integer', description: 'Total number of rules in this ruleset version', example: 60 },
566
+ releaseDate: { type: 'string', description: 'Release date of this ruleset version', example: '2025-11-19' },
567
+ deprecated: { type: 'boolean', description: 'Whether this ruleset version is deprecated', example: false },
568
+ tags: { type: 'array', description: 'Tags for filtering or grouping rulesets', items: { type: 'string' }, example: ['api-insights', 'documentation'] },
569
+ rules: { type: 'array', description: 'List of all individual rules in this ruleset version', items: { $ref: 'RuleInfo#' } },
570
+ },
571
+ };
572
+ export const StatsResponseSchema = {
573
+ $id: 'StatsResponse',
574
+ type: 'object',
575
+ description: 'Combined storage and orchestrator statistics',
576
+ properties: {
577
+ storage: {
578
+ type: 'object',
579
+ description: 'Statistics about the lint result storage backend',
580
+ properties: {
581
+ totalJobs: { type: 'integer', description: 'Total number of jobs stored', example: 42 },
582
+ totalResults: { type: 'integer', description: 'Total number of lint results stored', example: 42 },
583
+ storageSize: { type: 'number', description: 'Approximate storage size in bytes', example: 102400 },
584
+ },
585
+ },
586
+ orchestrator: {
587
+ type: 'object',
588
+ description: 'Orchestrator runtime statistics including active jobs and worker pool state',
589
+ additionalProperties: true,
590
+ example: { activeJobs: 0, totalJobsProcessed: 42, workerPoolSize: 4 },
591
+ },
592
+ timestamp: { type: 'string', format: 'date-time', description: 'ISO 8601 timestamp when the statistics were collected', example: '2026-03-05T12:00:00.000Z' },
593
+ },
594
+ };
595
+ // ============================================
596
+ // Query-string schemas (for route.schema.querystring)
597
+ // ============================================
598
+ export const DocumentListQuerySchema = {
599
+ type: 'object',
600
+ description: 'Query parameters for listing or searching documents',
601
+ properties: {
602
+ limit: { type: 'integer', default: 50, description: 'Maximum number of results to return' },
603
+ offset: { type: 'integer', default: 0, description: 'Number of results to skip for pagination' },
604
+ sortBy: { type: 'string', default: 'uploadedAt', description: 'Field to sort by' },
605
+ sortOrder: { type: 'string', enum: ['asc', 'desc'], default: 'desc', description: 'Sort direction' },
606
+ search: { type: 'string', description: 'Text search query across document metadata' },
607
+ organization: { type: 'string', description: 'Filter by organization' },
608
+ tags: { type: 'string', description: 'Comma-separated list of tags to filter by' },
609
+ format: { type: 'string', description: 'Filter by document format (json, yaml)' },
610
+ },
611
+ };
612
+ export const JobListQuerySchema = {
613
+ type: 'object',
614
+ description: 'Query parameters for listing lint jobs',
615
+ properties: {
616
+ status: { type: 'string', description: 'Filter by job status. Comma-separated for multiple values.' },
617
+ documentId: { type: 'string', description: 'Filter by document ID' },
618
+ rulesetName: { type: 'string', description: 'Filter by ruleset name' },
619
+ startDate: { type: 'string', format: 'date-time', description: 'Filter jobs created after this date (ISO 8601)' },
620
+ endDate: { type: 'string', format: 'date-time', description: 'Filter jobs created before this date (ISO 8601)' },
621
+ limit: { type: 'integer', default: 50, description: 'Maximum number of results' },
622
+ offset: { type: 'integer', default: 0, description: 'Pagination offset' },
623
+ sortBy: { type: 'string', default: 'timestamp', description: 'Field to sort by' },
624
+ sortOrder: { type: 'string', enum: ['asc', 'desc'], default: 'desc', description: 'Sort direction' },
625
+ },
626
+ };
627
+ export const RulesetNameParamSchema = {
628
+ type: 'object',
629
+ required: ['name'],
630
+ properties: {
631
+ name: { type: 'string', description: 'Ruleset name (e.g., pubhub, api-insights-completeness)' },
632
+ },
633
+ };
634
+ export const RulesetVersionQuerySchema = {
635
+ type: 'object',
636
+ properties: {
637
+ version: { type: 'string', description: 'Specific version to load. Defaults to the ruleset\'s default version.' },
638
+ },
639
+ };
640
+ // ============================================
641
+ // Convenience: all shared schemas in an array for addSchema()
642
+ // ============================================
643
+ export const sharedSchemas = [
644
+ ErrorResponseSchema,
645
+ JobStatusSchema,
646
+ JobProgressSchema,
647
+ SourcePositionSchema,
648
+ SourceRangeSchema,
649
+ LintIssueSchema,
650
+ ResultSummarySchema,
651
+ RulesetExecutionResultSchema,
652
+ RuleInfoSchema,
653
+ RuleOverridesSchema,
654
+ DocumentSummarySchema,
655
+ HealthResponseSchema,
656
+ DocumentUploadRequestSchema,
657
+ DocumentUploadResponseSchema,
658
+ DocumentListResponseSchema,
659
+ DocumentResponseSchema,
660
+ LintJobSubmitResponseSchema,
661
+ CapacityExceededResponseSchema,
662
+ LintJobStatusSchema,
663
+ LintJobResultSchema,
664
+ JobSummarySchema,
665
+ ReportGenerationRequestSchema,
666
+ SarifReportSchema,
667
+ JobListResponseSchema,
668
+ JobListDetailedResponseSchema,
669
+ CacheInvalidationResponseSchema,
670
+ RulesetSummarySchema,
671
+ RulesetDetailsSchema,
672
+ StatsResponseSchema,
673
+ ];
674
+ //# sourceMappingURL=schemas.js.map