@unispechq/unispec-schema 0.4.5 → 0.4.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/examples/valid/config/complete-enterprise.json +32 -4
- package/examples/valid/config/registry-based.json +12 -2
- package/examples/valid/config/simple-multi-service.json +15 -1
- package/examples/valid/spec/mixed-complete.json +0 -17
- package/package.json +1 -1
- package/schema/types/graphql.schema.json +1 -8
- package/schema/types/rest.schema.json +1 -8
- package/schema/types/service.schema.json +1 -86
- package/schema/types/websocket.schema.json +1 -8
- package/schema/unispec-config.schema.json +52 -0
|
@@ -30,7 +30,13 @@
|
|
|
30
30
|
[
|
|
31
31
|
"apiKeyAuth"
|
|
32
32
|
]
|
|
33
|
-
]
|
|
33
|
+
],
|
|
34
|
+
"rateLimit": {
|
|
35
|
+
"requestsPerMinute": 2000,
|
|
36
|
+
"requestsPerHour": 100000,
|
|
37
|
+
"perUser": true,
|
|
38
|
+
"burstLimit": 500
|
|
39
|
+
}
|
|
34
40
|
},
|
|
35
41
|
{
|
|
36
42
|
"name": "catalog-service",
|
|
@@ -44,6 +50,11 @@
|
|
|
44
50
|
},
|
|
45
51
|
"discovery": {
|
|
46
52
|
"dnsTemplate": "catalog-{env}.company.com"
|
|
53
|
+
},
|
|
54
|
+
"rateLimit": {
|
|
55
|
+
"requestsPerMinute": 5000,
|
|
56
|
+
"requestsPerDay": 1000000,
|
|
57
|
+
"perApiKey": true
|
|
47
58
|
}
|
|
48
59
|
},
|
|
49
60
|
{
|
|
@@ -52,6 +63,11 @@
|
|
|
52
63
|
"spec": {
|
|
53
64
|
"type": "registry",
|
|
54
65
|
"ref": "notification-service@v2.1.0"
|
|
66
|
+
},
|
|
67
|
+
"rateLimit": {
|
|
68
|
+
"requestsPerMinute": 10000,
|
|
69
|
+
"perUser": true,
|
|
70
|
+
"customKey": "tenantId"
|
|
55
71
|
}
|
|
56
72
|
}
|
|
57
73
|
],
|
|
@@ -61,10 +77,18 @@
|
|
|
61
77
|
"overrides": {
|
|
62
78
|
"services": {
|
|
63
79
|
"auth-service": {
|
|
64
|
-
"baseUrl": "http://localhost:8000"
|
|
80
|
+
"baseUrl": "http://localhost:8000",
|
|
81
|
+
"rateLimit": {
|
|
82
|
+
"inherit": true,
|
|
83
|
+
"requestsPerMinute": 5000
|
|
84
|
+
}
|
|
65
85
|
},
|
|
66
86
|
"catalog-service": {
|
|
67
|
-
"baseUrl": "http://localhost:8001"
|
|
87
|
+
"baseUrl": "http://localhost:8001",
|
|
88
|
+
"rateLimit": {
|
|
89
|
+
"inherit": true,
|
|
90
|
+
"requestsPerMinute": 10000
|
|
91
|
+
}
|
|
68
92
|
}
|
|
69
93
|
}
|
|
70
94
|
},
|
|
@@ -83,7 +107,11 @@
|
|
|
83
107
|
"overrides": {
|
|
84
108
|
"services": {
|
|
85
109
|
"auth-service": {
|
|
86
|
-
"baseUrl": "https://staging-auth.company.com"
|
|
110
|
+
"baseUrl": "https://staging-auth.company.com",
|
|
111
|
+
"rateLimit": {
|
|
112
|
+
"inherit": true,
|
|
113
|
+
"burstLimit": 200
|
|
114
|
+
}
|
|
87
115
|
}
|
|
88
116
|
}
|
|
89
117
|
},
|
|
@@ -19,7 +19,13 @@
|
|
|
19
19
|
[
|
|
20
20
|
"apiKeyAuth"
|
|
21
21
|
]
|
|
22
|
-
]
|
|
22
|
+
],
|
|
23
|
+
"rateLimit": {
|
|
24
|
+
"requestsPerMinute": 500,
|
|
25
|
+
"requestsPerHour": 30000,
|
|
26
|
+
"perApiKey": true,
|
|
27
|
+
"customKey": "organizationId"
|
|
28
|
+
}
|
|
23
29
|
}
|
|
24
30
|
],
|
|
25
31
|
"discovery": {
|
|
@@ -31,7 +37,11 @@
|
|
|
31
37
|
"overrides": {
|
|
32
38
|
"services": {
|
|
33
39
|
"payment-service": {
|
|
34
|
-
"baseUrl": "https://staging-payments.example.com"
|
|
40
|
+
"baseUrl": "https://staging-payments.example.com",
|
|
41
|
+
"rateLimit": {
|
|
42
|
+
"inherit": true,
|
|
43
|
+
"requestsPerMinute": 100
|
|
44
|
+
}
|
|
35
45
|
}
|
|
36
46
|
}
|
|
37
47
|
}
|
|
@@ -10,6 +10,10 @@
|
|
|
10
10
|
},
|
|
11
11
|
"health": {
|
|
12
12
|
"path": "/health"
|
|
13
|
+
},
|
|
14
|
+
"rateLimit": {
|
|
15
|
+
"requestsPerMinute": 1000,
|
|
16
|
+
"perUser": true
|
|
13
17
|
}
|
|
14
18
|
},
|
|
15
19
|
{
|
|
@@ -21,6 +25,11 @@
|
|
|
21
25
|
},
|
|
22
26
|
"health": {
|
|
23
27
|
"path": "/ping"
|
|
28
|
+
},
|
|
29
|
+
"rateLimit": {
|
|
30
|
+
"requestsPerHour": 50000,
|
|
31
|
+
"perApiKey": true,
|
|
32
|
+
"burstLimit": 1000
|
|
24
33
|
}
|
|
25
34
|
}
|
|
26
35
|
],
|
|
@@ -30,7 +39,12 @@
|
|
|
30
39
|
"overrides": {
|
|
31
40
|
"services": {
|
|
32
41
|
"user-service": {
|
|
33
|
-
"baseUrl": "http://localhost:3001"
|
|
42
|
+
"baseUrl": "http://localhost:3001",
|
|
43
|
+
"rateLimit": {
|
|
44
|
+
"inherit": true,
|
|
45
|
+
"requestsPerMinute": 100,
|
|
46
|
+
"perUser": false
|
|
47
|
+
}
|
|
34
48
|
},
|
|
35
49
|
"order-service": {
|
|
36
50
|
"baseUrl": "http://localhost:3002"
|
|
@@ -12,12 +12,6 @@
|
|
|
12
12
|
"name": "Apache 2.0",
|
|
13
13
|
"url": "https://opensource.org/licenses/Apache-2.0"
|
|
14
14
|
},
|
|
15
|
-
"tags": [
|
|
16
|
-
"ecommerce",
|
|
17
|
-
"rest",
|
|
18
|
-
"graphql",
|
|
19
|
-
"websocket"
|
|
20
|
-
],
|
|
21
15
|
"protocols": {
|
|
22
16
|
"rest": {
|
|
23
17
|
"routes": [
|
|
@@ -146,17 +140,6 @@
|
|
|
146
140
|
]
|
|
147
141
|
}
|
|
148
142
|
}
|
|
149
|
-
},
|
|
150
|
-
"securitySchemes": {
|
|
151
|
-
"bearerAuth": {
|
|
152
|
-
"type": "http",
|
|
153
|
-
"scheme": "bearer",
|
|
154
|
-
"bearerFormat": "JWT"
|
|
155
|
-
}
|
|
156
|
-
},
|
|
157
|
-
"rateLimit": {
|
|
158
|
-
"requestsPerMinute": 100,
|
|
159
|
-
"perUser": true
|
|
160
143
|
}
|
|
161
144
|
}
|
|
162
145
|
}
|
package/package.json
CHANGED
|
@@ -76,14 +76,7 @@
|
|
|
76
76
|
"description": {
|
|
77
77
|
"$ref": "./common.schema.json#/$defs/Description"
|
|
78
78
|
},
|
|
79
|
-
|
|
80
|
-
"type": "array",
|
|
81
|
-
"description": "Tags for grouping operations.",
|
|
82
|
-
"items": {
|
|
83
|
-
"$ref": "./common.schema.json#/$defs/Tag"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"deprecated": {
|
|
79
|
+
"deprecated": {
|
|
87
80
|
"type": "boolean",
|
|
88
81
|
"description": "Marks the operation as deprecated.",
|
|
89
82
|
"default": false
|
|
@@ -15,14 +15,7 @@
|
|
|
15
15
|
"type": "string",
|
|
16
16
|
"description": "Short, human-readable summary of the route."
|
|
17
17
|
},
|
|
18
|
-
|
|
19
|
-
"type": "array",
|
|
20
|
-
"description": "Tags for grouping operations.",
|
|
21
|
-
"items": {
|
|
22
|
-
"$ref": "./common.schema.json#/$defs/Tag"
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"deprecated": {
|
|
18
|
+
"deprecated": {
|
|
26
19
|
"type": "boolean",
|
|
27
20
|
"description": "Marks the route as deprecated.",
|
|
28
21
|
"default": false
|
|
@@ -14,14 +14,7 @@
|
|
|
14
14
|
"version": {
|
|
15
15
|
"$ref": "./common.schema.json#/$defs/Version"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
"type": "array",
|
|
19
|
-
"description": "Tags for grouping and categorizing the service.",
|
|
20
|
-
"items": {
|
|
21
|
-
"$ref": "./common.schema.json#/$defs/Tag"
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"contact": {
|
|
17
|
+
"contact": {
|
|
25
18
|
"type": "object",
|
|
26
19
|
"description": "Contact information for the service.",
|
|
27
20
|
"properties": {
|
|
@@ -52,23 +45,6 @@
|
|
|
52
45
|
},
|
|
53
46
|
"additionalProperties": false
|
|
54
47
|
},
|
|
55
|
-
"servers": {
|
|
56
|
-
"type": "array",
|
|
57
|
-
"description": "Alternative servers where the service is available.",
|
|
58
|
-
"items": {
|
|
59
|
-
"type": "object",
|
|
60
|
-
"properties": {
|
|
61
|
-
"url": {
|
|
62
|
-
"$ref": "./common.schema.json#/$defs/Url"
|
|
63
|
-
},
|
|
64
|
-
"description": {
|
|
65
|
-
"type": "string",
|
|
66
|
-
"description": "Description of the server."
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"additionalProperties": false
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
48
|
"protocols": {
|
|
73
49
|
"type": "object",
|
|
74
50
|
"description": "Protocol-specific API surfaces exposed by this service.",
|
|
@@ -87,67 +63,6 @@
|
|
|
87
63
|
},
|
|
88
64
|
"schemas": {
|
|
89
65
|
"$ref": "./schemas.schema.json#"
|
|
90
|
-
},
|
|
91
|
-
"securitySchemes": {
|
|
92
|
-
"type": "object",
|
|
93
|
-
"description": "Authentication mechanisms available for this service.",
|
|
94
|
-
"additionalProperties": {
|
|
95
|
-
"$ref": "./common.schema.json#/$defs/SecurityScheme"
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"rateLimit": {
|
|
99
|
-
"type": "object",
|
|
100
|
-
"description": "Rate limiting configuration for the service.",
|
|
101
|
-
"properties": {
|
|
102
|
-
"requestsPerMinute": {
|
|
103
|
-
"type": "integer",
|
|
104
|
-
"minimum": 0,
|
|
105
|
-
"description": "Maximum requests per minute."
|
|
106
|
-
},
|
|
107
|
-
"requestsPerHour": {
|
|
108
|
-
"type": "integer",
|
|
109
|
-
"minimum": 0,
|
|
110
|
-
"description": "Maximum requests per hour."
|
|
111
|
-
},
|
|
112
|
-
"requestsPerDay": {
|
|
113
|
-
"type": "integer",
|
|
114
|
-
"minimum": 0,
|
|
115
|
-
"description": "Maximum requests per day."
|
|
116
|
-
},
|
|
117
|
-
"burstLimit": {
|
|
118
|
-
"type": "integer",
|
|
119
|
-
"minimum": 0,
|
|
120
|
-
"description": "Maximum burst requests allowed."
|
|
121
|
-
},
|
|
122
|
-
"perUser": {
|
|
123
|
-
"type": "boolean",
|
|
124
|
-
"description": "Whether rate limiting is applied per user.",
|
|
125
|
-
"default": false
|
|
126
|
-
},
|
|
127
|
-
"perApiKey": {
|
|
128
|
-
"type": "boolean",
|
|
129
|
-
"description": "Whether rate limiting is applied per API key.",
|
|
130
|
-
"default": false
|
|
131
|
-
},
|
|
132
|
-
"customKey": {
|
|
133
|
-
"type": "string",
|
|
134
|
-
"description": "Custom key for rate limiting (e.g., IP address, organization ID)."
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
"additionalProperties": false
|
|
138
|
-
},
|
|
139
|
-
"compliance": {
|
|
140
|
-
"type": "array",
|
|
141
|
-
"description": "Compliance frameworks the service adheres to.",
|
|
142
|
-
"items": {
|
|
143
|
-
"type": "string",
|
|
144
|
-
"enum": ["GDPR", "SOC2", "HIPAA", "PCI-DSS", "ISO27001", "CCPA"]
|
|
145
|
-
}
|
|
146
|
-
},
|
|
147
|
-
"dataClassification": {
|
|
148
|
-
"type": "string",
|
|
149
|
-
"description": "Data classification level for the service.",
|
|
150
|
-
"enum": ["public", "internal", "confidential", "restricted"]
|
|
151
66
|
}
|
|
152
67
|
},
|
|
153
68
|
"additionalProperties": false
|
|
@@ -77,14 +77,7 @@
|
|
|
77
77
|
"description": {
|
|
78
78
|
"$ref": "./common.schema.json#/$defs/Description"
|
|
79
79
|
},
|
|
80
|
-
|
|
81
|
-
"type": "array",
|
|
82
|
-
"description": "Tags for grouping channels.",
|
|
83
|
-
"items": {
|
|
84
|
-
"$ref": "./common.schema.json#/$defs/Tag"
|
|
85
|
-
}
|
|
86
|
-
},
|
|
87
|
-
"namespace": {
|
|
80
|
+
"namespace": {
|
|
88
81
|
"type": "string",
|
|
89
82
|
"description": "Optional namespace for the channel (e.g. 'chat', 'notifications'). Used to group related channels and avoid name collisions."
|
|
90
83
|
},
|
|
@@ -64,6 +64,9 @@
|
|
|
64
64
|
"items": {
|
|
65
65
|
"$ref": "#/$defs/SecurityRequirement"
|
|
66
66
|
}
|
|
67
|
+
},
|
|
68
|
+
"rateLimit": {
|
|
69
|
+
"$ref": "#/$defs/RateLimit"
|
|
67
70
|
}
|
|
68
71
|
},
|
|
69
72
|
"additionalProperties": false
|
|
@@ -223,6 +226,9 @@
|
|
|
223
226
|
"items": {
|
|
224
227
|
"$ref": "#/$defs/SecurityRequirement"
|
|
225
228
|
}
|
|
229
|
+
},
|
|
230
|
+
"rateLimit": {
|
|
231
|
+
"$ref": "#/$defs/RateLimit"
|
|
226
232
|
}
|
|
227
233
|
},
|
|
228
234
|
"additionalProperties": false
|
|
@@ -467,6 +473,52 @@
|
|
|
467
473
|
},
|
|
468
474
|
"additionalProperties": false
|
|
469
475
|
},
|
|
476
|
+
"RateLimit": {
|
|
477
|
+
"type": "object",
|
|
478
|
+
"description": "Rate limiting configuration for the service.",
|
|
479
|
+
"properties": {
|
|
480
|
+
"inherit": {
|
|
481
|
+
"type": "boolean",
|
|
482
|
+
"description": "Whether to inherit from parent rate limit configuration. When true, only specified fields override parent values.",
|
|
483
|
+
"default": false
|
|
484
|
+
},
|
|
485
|
+
"requestsPerMinute": {
|
|
486
|
+
"type": "integer",
|
|
487
|
+
"minimum": 0,
|
|
488
|
+
"description": "Maximum requests per minute."
|
|
489
|
+
},
|
|
490
|
+
"requestsPerHour": {
|
|
491
|
+
"type": "integer",
|
|
492
|
+
"minimum": 0,
|
|
493
|
+
"description": "Maximum requests per hour."
|
|
494
|
+
},
|
|
495
|
+
"requestsPerDay": {
|
|
496
|
+
"type": "integer",
|
|
497
|
+
"minimum": 0,
|
|
498
|
+
"description": "Maximum requests per day."
|
|
499
|
+
},
|
|
500
|
+
"burstLimit": {
|
|
501
|
+
"type": "integer",
|
|
502
|
+
"minimum": 0,
|
|
503
|
+
"description": "Maximum burst requests allowed."
|
|
504
|
+
},
|
|
505
|
+
"perUser": {
|
|
506
|
+
"type": "boolean",
|
|
507
|
+
"description": "Whether rate limiting is applied per user.",
|
|
508
|
+
"default": false
|
|
509
|
+
},
|
|
510
|
+
"perApiKey": {
|
|
511
|
+
"type": "boolean",
|
|
512
|
+
"description": "Whether rate limiting is applied per API key.",
|
|
513
|
+
"default": false
|
|
514
|
+
},
|
|
515
|
+
"customKey": {
|
|
516
|
+
"type": "string",
|
|
517
|
+
"description": "Custom key for rate limiting (e.g., IP address, organization ID)."
|
|
518
|
+
}
|
|
519
|
+
},
|
|
520
|
+
"additionalProperties": false
|
|
521
|
+
},
|
|
470
522
|
"Audit": {
|
|
471
523
|
"type": "object",
|
|
472
524
|
"description": "Audit configuration for compliance.",
|