Commit a2d7a08
committed
feat(api): Refactor subscription model and add API placeholders
This commit introduces two main changes to improve the robustness of the user subscription feature and prepare for future API expansion.
**Forward-Compatible Subscription Triggers**
To prevent errors when a subscription trigger is deprecated or removed, the data model has been refactored to be forward-compatible.
- The OpenAPI specification now uses a `SubscriptionTriggerResponseItem` schema. This object returns the trigger's `value` and an optional `raw_value`.
- If a trigger stored in the database is no longer a valid API enum, its `value` is now set to 'unknown', and the original database string is preserved in `raw_value`. This ensures the API does not fail when encountering old data.
- The backend adapter and its tests have been updated to handle this new structure.
**API Endpoint Placeholders**
As part of the effort to split up a large pull request (#2041), this commit adds placeholder paths to `openapi.yaml` for future subscription management endpoints. These paths are for planning purposes and do not have functional implementations in this change:
- `/v1/users/me/subscriptions`
- `/v1/users/me/subscriptions/{subscription_id}`
**Other Changes**
- A specific error for unauthorized subscription creation attempts has been added.1 parent 9088392 commit a2d7a08
File tree
3 files changed
+429
-64
lines changed- lib/gcpspanner/spanneradapters
- openapi/backend
3 files changed
+429
-64
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1332 | 1332 | | |
1333 | 1333 | | |
1334 | 1334 | | |
| 1335 | + | |
| 1336 | + | |
| 1337 | + | |
| 1338 | + | |
| 1339 | + | |
| 1340 | + | |
| 1341 | + | |
| 1342 | + | |
| 1343 | + | |
| 1344 | + | |
| 1345 | + | |
| 1346 | + | |
| 1347 | + | |
| 1348 | + | |
| 1349 | + | |
| 1350 | + | |
| 1351 | + | |
| 1352 | + | |
| 1353 | + | |
| 1354 | + | |
| 1355 | + | |
| 1356 | + | |
| 1357 | + | |
| 1358 | + | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
| 1363 | + | |
| 1364 | + | |
| 1365 | + | |
| 1366 | + | |
| 1367 | + | |
| 1368 | + | |
| 1369 | + | |
| 1370 | + | |
| 1371 | + | |
| 1372 | + | |
| 1373 | + | |
| 1374 | + | |
| 1375 | + | |
| 1376 | + | |
| 1377 | + | |
| 1378 | + | |
| 1379 | + | |
| 1380 | + | |
| 1381 | + | |
| 1382 | + | |
| 1383 | + | |
| 1384 | + | |
| 1385 | + | |
| 1386 | + | |
| 1387 | + | |
1335 | 1388 | | |
1336 | 1389 | | |
1337 | 1390 | | |
1338 | 1391 | | |
1339 | 1392 | | |
1340 | 1393 | | |
1341 | | - | |
| 1394 | + | |
1342 | 1395 | | |
1343 | 1396 | | |
1344 | 1397 | | |
1345 | 1398 | | |
1346 | 1399 | | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
1347 | 1404 | | |
1348 | 1405 | | |
1349 | 1406 | | |
| |||
1415 | 1472 | | |
1416 | 1473 | | |
1417 | 1474 | | |
1418 | | - | |
| 1475 | + | |
| 1476 | + | |
| 1477 | + | |
1419 | 1478 | | |
1420 | 1479 | | |
1421 | 1480 | | |
| |||
1465 | 1524 | | |
1466 | 1525 | | |
1467 | 1526 | | |
1468 | | - | |
1469 | | - | |
| 1527 | + | |
| 1528 | + | |
1470 | 1529 | | |
1471 | 1530 | | |
1472 | 1531 | | |
| |||
0 commit comments