|
12 | 12 | ], |
13 | 13 | "paths": { |
14 | 14 | "/users": { |
| 15 | + "post": { |
| 16 | + "summary": "Create a new user", |
| 17 | + "description": "Creates a new user with the provided information.", |
| 18 | + "parameters": [ |
| 19 | + { |
| 20 | + "name": "X-API-Key", |
| 21 | + "in": "header", |
| 22 | + "required": true, |
| 23 | + "description": "API key for authentication", |
| 24 | + "schema": { |
| 25 | + "type": "string", |
| 26 | + "example": "api-key-123" |
| 27 | + } |
| 28 | + }, |
| 29 | + { |
| 30 | + "name": "X-Request-ID", |
| 31 | + "in": "header", |
| 32 | + "required": false, |
| 33 | + "description": "Unique request identifier for tracing", |
| 34 | + "schema": { |
| 35 | + "type": "string", |
| 36 | + "format": "uuid", |
| 37 | + "example": "123e4567-e89b-12d3-a456-426614174000" |
| 38 | + } |
| 39 | + }, |
| 40 | + { |
| 41 | + "name": "dryRun", |
| 42 | + "in": "query", |
| 43 | + "required": false, |
| 44 | + "description": "If true, validates the request without creating the user", |
| 45 | + "schema": { |
| 46 | + "type": "boolean", |
| 47 | + "default": false |
| 48 | + } |
| 49 | + }, |
| 50 | + { |
| 51 | + "name": "region", |
| 52 | + "in": "query", |
| 53 | + "required": false, |
| 54 | + "description": "Region for user creation", |
| 55 | + "schema": { |
| 56 | + "type": "string", |
| 57 | + "enum": ["us-east", "us-west", "eu-central"], |
| 58 | + "default": "us-east" |
| 59 | + } |
| 60 | + } |
| 61 | + ], |
| 62 | + "requestBody": { |
| 63 | + "required": true, |
| 64 | + "content": { |
| 65 | + "application/json": { |
| 66 | + "schema": { |
| 67 | + "type": "object", |
| 68 | + "required": ["name", "email"], |
| 69 | + "properties": { |
| 70 | + "name": { |
| 71 | + "type": "string", |
| 72 | + "description": "User's full name", |
| 73 | + "example": "John Doe", |
| 74 | + "minLength": 2, |
| 75 | + "maxLength": 100 |
| 76 | + }, |
| 77 | + "email": { |
| 78 | + "type": "string", |
| 79 | + "format": "email", |
| 80 | + "description": "User's email address", |
| 81 | + "example": "john.doe@example.com" |
| 82 | + }, |
| 83 | + "age": { |
| 84 | + "type": "integer", |
| 85 | + "description": "User's age in years", |
| 86 | + "example": 30, |
| 87 | + "minimum": 18, |
| 88 | + "maximum": 120 |
| 89 | + }, |
| 90 | + "address": { |
| 91 | + "type": "object", |
| 92 | + "description": "User's address information", |
| 93 | + "properties": { |
| 94 | + "street": { |
| 95 | + "type": "string", |
| 96 | + "example": "123 Main St" |
| 97 | + }, |
| 98 | + "city": { |
| 99 | + "type": "string", |
| 100 | + "example": "Anytown" |
| 101 | + }, |
| 102 | + "state": { |
| 103 | + "type": "string", |
| 104 | + "example": "CA" |
| 105 | + }, |
| 106 | + "zipCode": { |
| 107 | + "type": "string", |
| 108 | + "example": "12345" |
| 109 | + }, |
| 110 | + "country": { |
| 111 | + "type": "string", |
| 112 | + "example": "USA" |
| 113 | + } |
| 114 | + } |
| 115 | + }, |
| 116 | + "preferences": { |
| 117 | + "type": "array", |
| 118 | + "description": "User's preferences", |
| 119 | + "items": { |
| 120 | + "type": "string", |
| 121 | + "enum": ["email", "sms", "push"] |
| 122 | + }, |
| 123 | + "example": ["email", "push"] |
| 124 | + }, |
| 125 | + "metadata": { |
| 126 | + "type": "object", |
| 127 | + "description": "Additional user metadata", |
| 128 | + "additionalProperties": { |
| 129 | + "type": "string" |
| 130 | + }, |
| 131 | + "example": { |
| 132 | + "source": "web", |
| 133 | + "referral": "friend" |
| 134 | + } |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | + } |
| 139 | + } |
| 140 | + }, |
| 141 | + "responses": { |
| 142 | + "201": { |
| 143 | + "description": "User created successfully", |
| 144 | + "content": { |
| 145 | + "application/json": { |
| 146 | + "schema": { |
| 147 | + "type": "object", |
| 148 | + "properties": { |
| 149 | + "userId": { |
| 150 | + "type": "string", |
| 151 | + "description": "The ID of the newly created user", |
| 152 | + "example": "user-123" |
| 153 | + }, |
| 154 | + "name": { |
| 155 | + "type": "string", |
| 156 | + "example": "John Doe" |
| 157 | + }, |
| 158 | + "email": { |
| 159 | + "type": "string", |
| 160 | + "example": "john.doe@example.com" |
| 161 | + }, |
| 162 | + "createdAt": { |
| 163 | + "type": "string", |
| 164 | + "format": "date-time", |
| 165 | + "example": "2023-01-01T12:00:00Z" |
| 166 | + } |
| 167 | + } |
| 168 | + } |
| 169 | + } |
| 170 | + } |
| 171 | + }, |
| 172 | + "400": { |
| 173 | + "description": "Bad request - Invalid input data" |
| 174 | + }, |
| 175 | + "401": { |
| 176 | + "description": "Unauthorized - Invalid API key" |
| 177 | + }, |
| 178 | + "409": { |
| 179 | + "description": "Conflict - User with the same email already exists" |
| 180 | + }, |
| 181 | + "422": { |
| 182 | + "description": "Unprocessable Entity - Validation errors", |
| 183 | + "content": { |
| 184 | + "application/json": { |
| 185 | + "schema": { |
| 186 | + "type": "object", |
| 187 | + "properties": { |
| 188 | + "errors": { |
| 189 | + "type": "array", |
| 190 | + "items": { |
| 191 | + "type": "object", |
| 192 | + "properties": { |
| 193 | + "field": { |
| 194 | + "type": "string", |
| 195 | + "example": "email" |
| 196 | + }, |
| 197 | + "message": { |
| 198 | + "type": "string", |
| 199 | + "example": "Invalid email format" |
| 200 | + } |
| 201 | + } |
| 202 | + } |
| 203 | + } |
| 204 | + } |
| 205 | + } |
| 206 | + } |
| 207 | + } |
| 208 | + } |
| 209 | + } |
| 210 | + }, |
15 | 211 | "get": { |
16 | 212 | "summary": "List users", |
17 | 213 | "description": "Returns a list of users with optional filtering.", |
|
228 | 424 | } |
229 | 425 | } |
230 | 426 | } |
| 427 | + }, |
| 428 | + "/documents/{documentId}": { |
| 429 | + "put": { |
| 430 | + "summary": "Update document content", |
| 431 | + "description": "Updates an existing document with plain text content.", |
| 432 | + "parameters": [ |
| 433 | + { |
| 434 | + "name": "documentId", |
| 435 | + "in": "path", |
| 436 | + "required": true, |
| 437 | + "description": "The ID of the document to update", |
| 438 | + "schema": { |
| 439 | + "type": "string", |
| 440 | + "example": "doc-123" |
| 441 | + } |
| 442 | + }, |
| 443 | + { |
| 444 | + "name": "X-API-Key", |
| 445 | + "in": "header", |
| 446 | + "required": true, |
| 447 | + "description": "API key for authentication", |
| 448 | + "schema": { |
| 449 | + "type": "string", |
| 450 | + "example": "api-key-123" |
| 451 | + } |
| 452 | + }, |
| 453 | + { |
| 454 | + "name": "X-Transaction-ID", |
| 455 | + "in": "header", |
| 456 | + "required": false, |
| 457 | + "description": "Unique transaction identifier for tracing", |
| 458 | + "schema": { |
| 459 | + "type": "string", |
| 460 | + "format": "uuid", |
| 461 | + "example": "123e4567-e89b-12d3-a456-426614174000" |
| 462 | + } |
| 463 | + }, |
| 464 | + { |
| 465 | + "name": "version", |
| 466 | + "in": "query", |
| 467 | + "required": false, |
| 468 | + "description": "Document version for concurrency control", |
| 469 | + "schema": { |
| 470 | + "type": "integer", |
| 471 | + "minimum": 1, |
| 472 | + "example": 2 |
| 473 | + } |
| 474 | + }, |
| 475 | + { |
| 476 | + "name": "overwrite", |
| 477 | + "in": "query", |
| 478 | + "required": false, |
| 479 | + "description": "If true, completely overwrites the document instead of merging changes", |
| 480 | + "schema": { |
| 481 | + "type": "boolean", |
| 482 | + "default": false |
| 483 | + } |
| 484 | + }, |
| 485 | + { |
| 486 | + "name": "format", |
| 487 | + "in": "query", |
| 488 | + "required": false, |
| 489 | + "description": "Format of the document content", |
| 490 | + "schema": { |
| 491 | + "type": "string", |
| 492 | + "enum": ["plain", "markdown", "html"], |
| 493 | + "default": "plain" |
| 494 | + } |
| 495 | + }, |
| 496 | + { |
| 497 | + "name": "tags", |
| 498 | + "in": "query", |
| 499 | + "required": false, |
| 500 | + "description": "Tags to associate with the document", |
| 501 | + "schema": { |
| 502 | + "type": "array", |
| 503 | + "items": { |
| 504 | + "type": "string" |
| 505 | + }, |
| 506 | + "example": ["important", "draft"] |
| 507 | + }, |
| 508 | + "style": "form", |
| 509 | + "explode": true |
| 510 | + } |
| 511 | + ], |
| 512 | + "requestBody": { |
| 513 | + "required": true, |
| 514 | + "content": { |
| 515 | + "text/plain": { |
| 516 | + "schema": { |
| 517 | + "type": "string", |
| 518 | + "example": "This is the updated content of the document. It can contain multiple paragraphs and lines of text.\n\nThis is a new paragraph in the document." |
| 519 | + } |
| 520 | + } |
| 521 | + } |
| 522 | + }, |
| 523 | + "responses": { |
| 524 | + "200": { |
| 525 | + "description": "Document updated successfully", |
| 526 | + "content": { |
| 527 | + "application/json": { |
| 528 | + "schema": { |
| 529 | + "type": "object", |
| 530 | + "properties": { |
| 531 | + "documentId": { |
| 532 | + "type": "string", |
| 533 | + "example": "doc-123" |
| 534 | + }, |
| 535 | + "version": { |
| 536 | + "type": "integer", |
| 537 | + "example": 3 |
| 538 | + }, |
| 539 | + "updatedAt": { |
| 540 | + "type": "string", |
| 541 | + "format": "date-time", |
| 542 | + "example": "2023-01-01T12:00:00Z" |
| 543 | + }, |
| 544 | + "size": { |
| 545 | + "type": "integer", |
| 546 | + "example": 1024, |
| 547 | + "description": "Size of the document in bytes" |
| 548 | + } |
| 549 | + } |
| 550 | + } |
| 551 | + } |
| 552 | + } |
| 553 | + }, |
| 554 | + "400": { |
| 555 | + "description": "Bad request - Invalid input data" |
| 556 | + }, |
| 557 | + "401": { |
| 558 | + "description": "Unauthorized - Invalid API key" |
| 559 | + }, |
| 560 | + "404": { |
| 561 | + "description": "Document not found" |
| 562 | + }, |
| 563 | + "409": { |
| 564 | + "description": "Conflict - Version mismatch" |
| 565 | + }, |
| 566 | + "413": { |
| 567 | + "description": "Payload Too Large - Document size exceeds limits" |
| 568 | + } |
| 569 | + } |
| 570 | + } |
231 | 571 | } |
232 | 572 | } |
233 | 573 | } |
0 commit comments