Skip to content

Commit f557728

Browse files
committed
fix(openapi): resolve lint errors and add lefthook pre-commit check
- Move ConfigBackupEnvelope from securitySchemes to its own schema file - Fix adapter property nesting in ProviderConfig (was outside properties block) - Fix to use split-spec relative paths in backup/restore paths - Remove invalid description sibling of in restore path - Add openapi-lint lefthook command for docs/openapi/ changes
1 parent a93bc29 commit f557728

6 files changed

Lines changed: 87 additions & 85 deletions

File tree

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
type: object
2+
required:
3+
- plexus_backup
4+
- version
5+
- created_at
6+
- data
7+
properties:
8+
plexus_backup:
9+
type: boolean
10+
const: true
11+
version:
12+
type: integer
13+
description: Schema version for forward-compatible migration.
14+
const: 1
15+
created_at:
16+
type: string
17+
format: date-time
18+
description: ISO 8601 timestamp of when the backup was created.
19+
dialect:
20+
type: string
21+
enum: [sqlite, postgres]
22+
description: Source database dialect (informational; not used on import).
23+
data:
24+
type: object
25+
description: All configuration tables.
26+
required:
27+
- providers
28+
- models
29+
- keys
30+
- user_quotas
31+
- mcp_servers
32+
- settings
33+
- oauth_credentials
34+
properties:
35+
providers:
36+
type: object
37+
additionalProperties: true
38+
description: Map of provider slug to provider configuration.
39+
models:
40+
type: object
41+
additionalProperties: true
42+
description: Map of model alias slug to model configuration.
43+
keys:
44+
type: object
45+
additionalProperties: true
46+
description: Map of key name to API key configuration.
47+
user_quotas:
48+
type: object
49+
additionalProperties: true
50+
description: Map of quota name to quota definition.
51+
mcp_servers:
52+
type: object
53+
additionalProperties: true
54+
description: Map of MCP server name to server configuration.
55+
settings:
56+
type: object
57+
additionalProperties: true
58+
description: Map of setting key to value.
59+
oauth_credentials:
60+
type: array
61+
items:
62+
type: object
63+
required:
64+
- provider_type
65+
- account_id
66+
- access_token
67+
- refresh_token
68+
- expires_at
69+
properties:
70+
provider_type:
71+
type: string
72+
account_id:
73+
type: string
74+
access_token:
75+
type: string
76+
refresh_token:
77+
type: string
78+
expires_at:
79+
type: number

docs/openapi/components/schemas/ProviderConfig.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ properties:
104104
type: object
105105
additionalProperties: true
106106
description: Extra fields merged into the request body for this model.
107-
adapter:
107+
adapter:
108108
oneOf:
109109
- type: string
110110
- type: array

docs/openapi/openapi.yaml

Lines changed: 0 additions & 81 deletions
Original file line numberDiff line numberDiff line change
@@ -539,84 +539,3 @@ components:
539539
description: |
540540
Either the server's `ADMIN_KEY` (full admin access) or the plaintext
541541
secret of a configured API key (limited access, scoped to that key).
542-
schemas:
543-
ConfigBackupEnvelope:
544-
type: object
545-
required:
546-
- plexus_backup
547-
- version
548-
- created_at
549-
- data
550-
properties:
551-
plexus_backup:
552-
type: boolean
553-
const: true
554-
version:
555-
type: integer
556-
description: Schema version for forward-compatible migration.
557-
const: 1
558-
created_at:
559-
type: string
560-
format: date-time
561-
description: ISO 8601 timestamp of when the backup was created.
562-
dialect:
563-
type: string
564-
enum: [sqlite, postgres]
565-
description: Source database dialect (informational; not used on import).
566-
data:
567-
type: object
568-
description: All configuration tables.
569-
required:
570-
- providers
571-
- models
572-
- keys
573-
- user_quotas
574-
- mcp_servers
575-
- settings
576-
- oauth_credentials
577-
properties:
578-
providers:
579-
type: object
580-
additionalProperties: true
581-
description: Map of provider slug to provider configuration.
582-
models:
583-
type: object
584-
additionalProperties: true
585-
description: Map of model alias slug to model configuration.
586-
keys:
587-
type: object
588-
additionalProperties: true
589-
description: Map of key name to API key configuration.
590-
user_quotas:
591-
type: object
592-
additionalProperties: true
593-
description: Map of quota name to quota definition.
594-
mcp_servers:
595-
type: object
596-
additionalProperties: true
597-
description: Map of MCP server name to server configuration.
598-
settings:
599-
type: object
600-
additionalProperties: true
601-
description: Map of setting key to value.
602-
oauth_credentials:
603-
type: array
604-
items:
605-
type: object
606-
required:
607-
- provider_type
608-
- account_id
609-
- access_token
610-
- refresh_token
611-
- expires_at
612-
properties:
613-
provider_type:
614-
type: string
615-
account_id:
616-
type: string
617-
access_token:
618-
type: string
619-
refresh_token:
620-
type: string
621-
expires_at:
622-
type: number

docs/openapi/paths/v0_management_backup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ get:
3737
content:
3838
application/json:
3939
schema:
40-
$ref: '#/components/schemas/ConfigBackupEnvelope'
40+
$ref: ../components/schemas/ConfigBackupEnvelope.yaml
4141
application/gzip:
4242
schema:
4343
type: string

docs/openapi/paths/v0_management_restore.yaml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,7 @@ post:
3131
content:
3232
application/json:
3333
schema:
34-
$ref: '#/components/schemas/ConfigBackupEnvelope'
35-
description: Config-only backup envelope.
34+
$ref: ../components/schemas/ConfigBackupEnvelope.yaml
3635
application/octet-stream:
3736
schema:
3837
type: string

lefthook.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,11 @@ pre-commit:
5555
glob: "packages/frontend/src/**"
5656
run: bun run build:frontend
5757

58+
# --- OpenAPI spec lint (only when OpenAPI docs change) -----------------
59+
openapi-lint:
60+
glob: "docs/openapi/**"
61+
run: bun run lint:openapi
62+
5863
# --- Backend tests (only when backend source changes) --------------------
5964
backend-tests:
6065
glob: "packages/backend/src/**"

0 commit comments

Comments
 (0)