You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
6869: Improve OpenAPI spec with descriptions, examples, and error codes
Add proper documentation to the auto-generated OpenAPI spec:
- API title, description, and version in api_platform.yaml
- Operation summary and description for the POST endpoint
- Field-level descriptions, examples, and enum for DetectionResult
- 401/403 error responses for authentication/authorization failures
- Server URL from COMPOSE_SERVER_DOMAIN/COMPOSE_DOMAIN env vars
- Security scheme description documenting the Apikey header format
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: config/packages/api_platform.yaml
+4Lines changed: 4 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -1,4 +1,8 @@
1
1
api_platform:
2
+
title: 'ITKsites Detection API'
3
+
description: 'REST API for ingesting server detection results from the ITK sites server harvester. Detection results are processed asynchronously to track servers, sites, domains, packages, modules, Docker images, and git repositories.'
Copy file name to clipboardExpand all lines: public/api-spec-v1.json
+28-12Lines changed: 28 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,13 +1,13 @@
1
1
{
2
2
"openapi": "3.1.0",
3
3
"info": {
4
-
"title": "",
5
-
"description": "",
6
-
"version": "0.0.0"
4
+
"title": "ITKsites Detection API",
5
+
"description": "REST API for ingesting server detection results from the ITK sites server harvester. Detection results are processed asynchronously to track servers, sites, domains, packages, modules, Docker images, and git repositories.",
"description": "Unauthorized \u2014 missing or invalid API key. The Authorization header must use the format: Apikey {key}"
49
+
},
50
+
"403": {
51
+
"description": "Forbidden \u2014 the authenticated server does not have the required ROLE_SERVER role"
52
+
},
47
53
"422": {
48
-
"description": "An error occurred",
54
+
"description": "Validation error \u2014 one or more fields failed constraint validation",
49
55
"content": {
50
56
"application/ld+json": {
51
57
"schema": {
@@ -66,8 +72,8 @@
66
72
"links": {}
67
73
}
68
74
},
69
-
"summary": "Creates a DetectionResult resource.",
70
-
"description": "Creates a DetectionResult resource.",
75
+
"summary": "Submit a detection result for async processing",
76
+
"description": "Accepts a detection result from the server harvester and queues it for asynchronous processing. The result is deduplicated by content hash \u2014 identical submissions update the last contact timestamp without triggering reprocessing. Returns 202 Accepted with an empty body.",
71
77
"parameters": [],
72
78
"requestBody": {
73
79
"description": "The new DetectionResult resource",
@@ -228,15 +234,25 @@
228
234
"type": "object",
229
235
"properties": {
230
236
"type": {
231
-
"default": "",
232
-
"type": "string"
237
+
"enum": [
238
+
"dir",
239
+
"docker",
240
+
"drupal",
241
+
"git",
242
+
"nginx",
243
+
"symfony"
244
+
]
233
245
},
234
246
"rootDir": {
247
+
"description": "Absolute path to the root directory of the detected installation on the server",
235
248
"default": "",
249
+
"example": "/data/www/example-site/htdocs",
236
250
"type": "string"
237
251
},
238
252
"data": {
253
+
"description": "JSON-encoded payload from the server harvester containing the detection details. Structure varies by type.",
Copy file name to clipboardExpand all lines: public/api-spec-v1.yaml
+25-12Lines changed: 25 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
openapi: 3.1.0
2
2
info:
3
-
title: ''
4
-
description: ''
5
-
version: 0.0.0
3
+
title: 'ITKsites Detection API'
4
+
description: 'REST API for ingesting server detection results from the ITK sites server harvester. Detection results are processed asynchronously to track servers, sites, domains, packages, modules, Docker images, and git repositories.'
5
+
version: 1.0.0
6
6
servers:
7
7
-
8
-
url: /
8
+
url: 'https://itksites.local.itkdev.dk'
9
9
description: ''
10
10
paths:
11
11
/api/detection_results:
@@ -15,10 +15,10 @@ paths:
15
15
- DetectionResult
16
16
responses:
17
17
'202':
18
-
description: 'DetectionResult resource created'
18
+
description: 'Detection result accepted for processing'
description: 'Unauthorized — missing or invalid API key. The Authorization header must use the format: Apikey {key}'
35
+
'403':
36
+
description: 'Forbidden — the authenticated server does not have the required ROLE_SERVER role'
33
37
'422':
34
-
description: 'An error occurred'
38
+
description: 'Validation error — one or more fields failed constraint validation'
35
39
content:
36
40
application/ld+json:
37
41
schema:
@@ -43,8 +47,8 @@ paths:
43
47
schema:
44
48
$ref: '#/components/schemas/ConstraintViolation'
45
49
links: { }
46
-
summary: 'Creates a DetectionResult resource.'
47
-
description: 'Creates a DetectionResult resource.'
50
+
summary: 'Submit a detection result for async processing'
51
+
description: 'Accepts a detection result from the server harvester and queues it for asynchronous processing. The result is deduplicated by content hash — identical submissions update the last contact timestamp without triggering reprocessing. Returns 202 Accepted with an empty body.'
48
52
parameters: []
49
53
requestBody:
50
54
description: 'The new DetectionResult resource'
@@ -159,13 +163,22 @@ components:
159
163
type: object
160
164
properties:
161
165
type:
162
-
default: ''
163
-
type: string
166
+
enum:
167
+
- dir
168
+
- docker
169
+
- drupal
170
+
- git
171
+
- nginx
172
+
- symfony
164
173
rootDir:
174
+
description: 'Absolute path to the root directory of the detected installation on the server'
165
175
default: ''
176
+
example: /data/www/example-site/htdocs
166
177
type: string
167
178
data:
179
+
description: 'JSON-encoded payload from the server harvester containing the detection details. Structure varies by type.'
summary: 'Submit a detection result for async processing',
25
+
description: 'Accepts a detection result from the server harvester and queues it for asynchronous processing. The result is deduplicated by content hash — identical submissions update the last contact timestamp without triggering reprocessing. Returns 202 Accepted with an empty body.',
26
+
responses: [
27
+
'202' => newModel\Response(
28
+
description: 'Detection result accepted for processing',
0 commit comments