-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathopenapi.yaml
More file actions
283 lines (269 loc) · 9.04 KB
/
Copy pathopenapi.yaml
File metadata and controls
283 lines (269 loc) · 9.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
openapi: 3.0.3
info:
title: Relay Git Sync API
description: |
REST API for Relay Git Sync service - a real-time synchronization bridge between
Relay Server collaborative documents and Git repositories.
This API provides both webhook endpoints for Relay Server integration and public
management endpoints for operational tasks.
version: 1.0.0
contact:
name: System 3
license:
name: MIT
servers:
- url: http://localhost:8000
description: Local development server
- url: https://your-git-sync-server.com
description: Production server
paths:
/health:
get:
summary: Health check
description: Returns the current health status of the service
tags:
- Health
security: [] # No authentication required
responses:
'200':
description: Service is healthy
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "healthy"
required:
- status
/api/pubkey:
get:
summary: Get SSH public key
description: |
Returns the SSH public key used for Git operations. This endpoint does not
require authentication and can be used by CI/CD systems to programmatically
retrieve the public key for Git hosting service configuration.
tags:
- SSH Keys
security: [] # No authentication required
responses:
'200':
description: SSH public key retrieved successfully
content:
application/json:
schema:
type: object
properties:
public_key:
type: string
description: The SSH public key in OpenSSH format
example: "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIExampleKeyDataHereForTesting"
key_type:
type: string
description: The type of SSH key
enum: [ssh-rsa, ssh-ed25519, ecdsa, unknown]
example: "ssh-ed25519"
required:
- public_key
- key_type
'400':
description: SSH private key not configured
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "SSH_PRIVATE_KEY environment variable not configured"
'500':
description: Internal server error retrieving public key
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Failed to retrieve public key: Invalid key format"
/docs:
get:
summary: Interactive API documentation
description: |
Serves interactive Swagger UI documentation for this API. This provides
a web interface for exploring and testing API endpoints.
tags:
- Documentation
security: [] # No authentication required
responses:
'200':
description: Swagger UI documentation page
content:
text/html:
schema:
type: string
example: "<!DOCTYPE html>..."
/openapi.yaml:
get:
summary: OpenAPI specification
description: |
Returns the OpenAPI 3.0.3 specification for this API in YAML format.
The server URL in the specification is dynamically updated to match
the current request.
tags:
- Documentation
security: [] # No authentication required
responses:
'200':
description: OpenAPI specification in YAML format
content:
application/x-yaml:
schema:
type: string
example: |
openapi: 3.0.3
info:
title: Relay Git Sync API
version: 1.0.0
'404':
description: OpenAPI specification file not found
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "OpenAPI specification file not found"
'500':
description: Error loading specification
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Failed to load OpenAPI specification: Permission denied"
/webhooks:
post:
summary: Receive document change webhook
description: |
Receives document change notifications from Relay Server. This endpoint
processes webhook payloads and triggers synchronization operations.
Authentication is required using either:
- Bearer token matching WEBHOOK_SECRET environment variable
- Svix HMAC signature validation (for whsec_ prefixed secrets)
tags:
- Webhooks
security:
- webhookAuth: []
- svixSignature: []
requestBody:
required: true
content:
application/json:
schema:
type: object
properties:
payload:
type: object
properties:
doc_id:
type: string
description: Compound document ID (relay_uuid-doc_uuid)
example: "12345678-1234-5678-9abc-123456789012-87654321-4321-8765-cba9-876543210987"
timestamp:
type: string
format: date-time
description: ISO 8601 timestamp of the change
example: "2023-01-01T12:00:00Z"
required:
- doc_id
- timestamp
required:
- payload
example:
payload:
doc_id: "12345678-1234-5678-9abc-123456789012-87654321-4321-8765-cba9-876543210987"
timestamp: "2023-01-01T12:00:00Z"
responses:
'200':
description: Webhook received and processed successfully
content:
application/json:
schema:
type: object
properties:
status:
type: string
example: "received"
required:
- status
'400':
description: Invalid webhook payload
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Invalid JSON payload"
'401':
description: Authentication required or failed
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
examples:
missing_auth:
summary: Missing authentication
value:
error: "Authentication required"
invalid_auth:
summary: Invalid authentication
value:
error: "Authentication failed: Invalid shared secret"
signature_failed:
summary: Signature validation failed
value:
error: "Authentication failed: Signature validation failed"
'500':
description: Internal server error processing webhook
content:
application/json:
schema:
$ref: '#/components/schemas/Error'
example:
error: "Internal server error"
components:
schemas:
Error:
type: object
properties:
error:
type: string
description: Human-readable error message
required:
- error
securitySchemes:
webhookAuth:
type: http
scheme: bearer
description: |
Bearer token authentication using the WEBHOOK_SECRET environment variable.
The token should exactly match the configured webhook secret.
svixSignature:
type: apiKey
in: header
name: svix-signature
description: |
Svix HMAC signature validation. Requires the following headers:
- svix-id (or webhook-id): Message ID
- svix-timestamp (or webhook-timestamp): Unix timestamp
- svix-signature (or webhook-signature): HMAC signature
Used when WEBHOOK_SECRET starts with 'whsec_' prefix.
tags:
- name: Health
description: Service health and status endpoints
- name: SSH Keys
description: SSH key management and retrieval
- name: Webhooks
description: Webhook endpoints for document change notifications
- name: Documentation
description: API documentation and specification endpoints
externalDocs:
description: GitHub Repository
url: https://github.com/your-org/relay-git-sync