@unispechq/unispec-schema 0.4.0 → 0.4.2

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.
Files changed (44) hide show
  1. package/README.md +170 -162
  2. package/examples/README.md +128 -0
  3. package/examples/invalid/config/additional-properties.json +26 -0
  4. package/examples/invalid/config/missing-service-name.json +22 -0
  5. package/examples/invalid/config/missing-version.json +6 -0
  6. package/examples/invalid/graphql-additional-properties.json +22 -0
  7. package/examples/invalid/graphql-missing-arg-type.json +26 -0
  8. package/examples/invalid/graphql-missing-name.json +19 -0
  9. package/examples/invalid/graphql-missing-schema.json +19 -0
  10. package/examples/invalid/mixed-invalid-protocol.json +26 -0
  11. package/examples/invalid/mixed-missing-graphql-schema.json +33 -0
  12. package/examples/invalid/mixed-multiple-errors.json +41 -0
  13. package/examples/invalid/rest-additional-properties.json +25 -0
  14. package/examples/invalid/rest-invalid-identifiers.json +29 -0
  15. package/examples/invalid/rest-invalid-method.json +23 -0
  16. package/examples/invalid/rest-missing-required.json +21 -0
  17. package/examples/invalid/websocket-additional-properties.json +27 -0
  18. package/examples/invalid/websocket-invalid-direction.json +27 -0
  19. package/examples/invalid/websocket-missing-channel-name.json +25 -0
  20. package/examples/invalid/websocket-missing-message-name.json +25 -0
  21. package/examples/valid/config/complete.json +61 -0
  22. package/examples/valid/config/minimal.json +8 -0
  23. package/examples/valid/graphql-complete.json +348 -0
  24. package/examples/valid/graphql-simple.json +34 -0
  25. package/examples/valid/mixed-complete.json +799 -0
  26. package/examples/valid/mixed-simple.json +56 -0
  27. package/examples/valid/rest-complete.json +539 -0
  28. package/examples/valid/rest-simple.json +279 -0
  29. package/examples/valid/websocket-complete.json +471 -0
  30. package/examples/valid/websocket-simple.json +116 -0
  31. package/index.cjs +7 -7
  32. package/index.d.ts +9 -9
  33. package/index.mjs +9 -9
  34. package/package.json +15 -6
  35. package/schema/index.json +19 -19
  36. package/schema/types/common.schema.json +195 -195
  37. package/schema/types/graphql.schema.json +172 -172
  38. package/schema/types/rest.schema.json +221 -226
  39. package/schema/types/schemas.schema.json +84 -84
  40. package/schema/types/service.schema.json +158 -158
  41. package/schema/types/websocket.schema.json +185 -190
  42. package/schema/unispec-config.schema.json +509 -509
  43. package/schema/unispec-tests.schema.json +368 -378
  44. package/schema/unispec.schema.json +18 -23
@@ -1,158 +1,158 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/types/service.schema.json",
4
- "title": "UniSpec Service",
5
- "type": "object",
6
- "required": ["name"],
7
- "properties": {
8
- "name": {
9
- "$ref": "./common.schema.json#/$defs/Identifier"
10
- },
11
- "description": {
12
- "$ref": "./common.schema.json#/$defs/Description"
13
- },
14
- "version": {
15
- "$ref": "./common.schema.json#/$defs/Version"
16
- },
17
- "tags": {
18
- "type": "array",
19
- "description": "Tags for grouping and categorizing the service.",
20
- "items": {
21
- "$ref": "./common.schema.json#/$defs/Tag"
22
- }
23
- },
24
- "baseUrl": {
25
- "$ref": "./common.schema.json#/$defs/Url",
26
- "description": "Base URL for the service. Used as the default prefix for all protocol endpoints."
27
- },
28
- "contact": {
29
- "type": "object",
30
- "description": "Contact information for the service.",
31
- "properties": {
32
- "name": {
33
- "type": "string",
34
- "description": "Contact name."
35
- },
36
- "email": {
37
- "$ref": "./common.schema.json#/$defs/Email"
38
- },
39
- "url": {
40
- "$ref": "./common.schema.json#/$defs/Url"
41
- }
42
- },
43
- "additionalProperties": false
44
- },
45
- "license": {
46
- "type": "object",
47
- "description": "License information for the service.",
48
- "properties": {
49
- "name": {
50
- "type": "string",
51
- "description": "License name."
52
- },
53
- "url": {
54
- "$ref": "./common.schema.json#/$defs/Url"
55
- }
56
- },
57
- "additionalProperties": false
58
- },
59
- "servers": {
60
- "type": "array",
61
- "description": "Alternative servers where the service is available.",
62
- "items": {
63
- "type": "object",
64
- "properties": {
65
- "url": {
66
- "$ref": "./common.schema.json#/$defs/Url"
67
- },
68
- "description": {
69
- "type": "string",
70
- "description": "Description of the server."
71
- }
72
- },
73
- "additionalProperties": false
74
- }
75
- },
76
- "protocols": {
77
- "type": "object",
78
- "description": "Protocol-specific API surfaces exposed by this service.",
79
- "properties": {
80
- "rest": {
81
- "$ref": "./rest.schema.json#"
82
- },
83
- "graphql": {
84
- "$ref": "./graphql.schema.json#"
85
- },
86
- "websocket": {
87
- "$ref": "./websocket.schema.json#"
88
- }
89
- },
90
- "additionalProperties": false
91
- },
92
- "schemas": {
93
- "$ref": "./schemas.schema.json#"
94
- },
95
- "securitySchemes": {
96
- "type": "object",
97
- "description": "Authentication mechanisms available for this service.",
98
- "additionalProperties": {
99
- "$ref": "./common.schema.json#/$defs/SecurityScheme"
100
- }
101
- },
102
- "rateLimit": {
103
- "type": "object",
104
- "description": "Rate limiting configuration for the service.",
105
- "properties": {
106
- "requestsPerMinute": {
107
- "type": "integer",
108
- "minimum": 0,
109
- "description": "Maximum requests per minute."
110
- },
111
- "requestsPerHour": {
112
- "type": "integer",
113
- "minimum": 0,
114
- "description": "Maximum requests per hour."
115
- },
116
- "requestsPerDay": {
117
- "type": "integer",
118
- "minimum": 0,
119
- "description": "Maximum requests per day."
120
- },
121
- "burstLimit": {
122
- "type": "integer",
123
- "minimum": 0,
124
- "description": "Maximum burst requests allowed."
125
- },
126
- "perUser": {
127
- "type": "boolean",
128
- "description": "Whether rate limiting is applied per user.",
129
- "default": false
130
- },
131
- "perApiKey": {
132
- "type": "boolean",
133
- "description": "Whether rate limiting is applied per API key.",
134
- "default": false
135
- },
136
- "customKey": {
137
- "type": "string",
138
- "description": "Custom key for rate limiting (e.g., IP address, organization ID)."
139
- }
140
- },
141
- "additionalProperties": false
142
- },
143
- "compliance": {
144
- "type": "array",
145
- "description": "Compliance frameworks the service adheres to.",
146
- "items": {
147
- "type": "string",
148
- "enum": ["GDPR", "SOC2", "HIPAA", "PCI-DSS", "ISO27001", "CCPA"]
149
- }
150
- },
151
- "dataClassification": {
152
- "type": "string",
153
- "description": "Data classification level for the service.",
154
- "enum": ["public", "internal", "confidential", "restricted"]
155
- }
156
- },
157
- "additionalProperties": false
158
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/types/service.schema.json",
4
+ "title": "UniSpec Service",
5
+ "type": "object",
6
+ "required": ["name"],
7
+ "properties": {
8
+ "name": {
9
+ "$ref": "./common.schema.json#/$defs/Identifier"
10
+ },
11
+ "description": {
12
+ "$ref": "./common.schema.json#/$defs/Description"
13
+ },
14
+ "version": {
15
+ "$ref": "./common.schema.json#/$defs/Version"
16
+ },
17
+ "tags": {
18
+ "type": "array",
19
+ "description": "Tags for grouping and categorizing the service.",
20
+ "items": {
21
+ "$ref": "./common.schema.json#/$defs/Tag"
22
+ }
23
+ },
24
+ "baseUrl": {
25
+ "$ref": "./common.schema.json#/$defs/Url",
26
+ "description": "Base URL for the service. Used as the default prefix for all protocol endpoints."
27
+ },
28
+ "contact": {
29
+ "type": "object",
30
+ "description": "Contact information for the service.",
31
+ "properties": {
32
+ "name": {
33
+ "type": "string",
34
+ "description": "Contact name."
35
+ },
36
+ "email": {
37
+ "$ref": "./common.schema.json#/$defs/Email"
38
+ },
39
+ "url": {
40
+ "$ref": "./common.schema.json#/$defs/Url"
41
+ }
42
+ },
43
+ "additionalProperties": false
44
+ },
45
+ "license": {
46
+ "type": "object",
47
+ "description": "License information for the service.",
48
+ "properties": {
49
+ "name": {
50
+ "type": "string",
51
+ "description": "License name."
52
+ },
53
+ "url": {
54
+ "$ref": "./common.schema.json#/$defs/Url"
55
+ }
56
+ },
57
+ "additionalProperties": false
58
+ },
59
+ "servers": {
60
+ "type": "array",
61
+ "description": "Alternative servers where the service is available.",
62
+ "items": {
63
+ "type": "object",
64
+ "properties": {
65
+ "url": {
66
+ "$ref": "./common.schema.json#/$defs/Url"
67
+ },
68
+ "description": {
69
+ "type": "string",
70
+ "description": "Description of the server."
71
+ }
72
+ },
73
+ "additionalProperties": false
74
+ }
75
+ },
76
+ "protocols": {
77
+ "type": "object",
78
+ "description": "Protocol-specific API surfaces exposed by this service.",
79
+ "properties": {
80
+ "rest": {
81
+ "$ref": "./rest.schema.json#"
82
+ },
83
+ "graphql": {
84
+ "$ref": "./graphql.schema.json#"
85
+ },
86
+ "websocket": {
87
+ "$ref": "./websocket.schema.json#"
88
+ }
89
+ },
90
+ "additionalProperties": false
91
+ },
92
+ "schemas": {
93
+ "$ref": "./schemas.schema.json#"
94
+ },
95
+ "securitySchemes": {
96
+ "type": "object",
97
+ "description": "Authentication mechanisms available for this service.",
98
+ "additionalProperties": {
99
+ "$ref": "./common.schema.json#/$defs/SecurityScheme"
100
+ }
101
+ },
102
+ "rateLimit": {
103
+ "type": "object",
104
+ "description": "Rate limiting configuration for the service.",
105
+ "properties": {
106
+ "requestsPerMinute": {
107
+ "type": "integer",
108
+ "minimum": 0,
109
+ "description": "Maximum requests per minute."
110
+ },
111
+ "requestsPerHour": {
112
+ "type": "integer",
113
+ "minimum": 0,
114
+ "description": "Maximum requests per hour."
115
+ },
116
+ "requestsPerDay": {
117
+ "type": "integer",
118
+ "minimum": 0,
119
+ "description": "Maximum requests per day."
120
+ },
121
+ "burstLimit": {
122
+ "type": "integer",
123
+ "minimum": 0,
124
+ "description": "Maximum burst requests allowed."
125
+ },
126
+ "perUser": {
127
+ "type": "boolean",
128
+ "description": "Whether rate limiting is applied per user.",
129
+ "default": false
130
+ },
131
+ "perApiKey": {
132
+ "type": "boolean",
133
+ "description": "Whether rate limiting is applied per API key.",
134
+ "default": false
135
+ },
136
+ "customKey": {
137
+ "type": "string",
138
+ "description": "Custom key for rate limiting (e.g., IP address, organization ID)."
139
+ }
140
+ },
141
+ "additionalProperties": false
142
+ },
143
+ "compliance": {
144
+ "type": "array",
145
+ "description": "Compliance frameworks the service adheres to.",
146
+ "items": {
147
+ "type": "string",
148
+ "enum": ["GDPR", "SOC2", "HIPAA", "PCI-DSS", "ISO27001", "CCPA"]
149
+ }
150
+ },
151
+ "dataClassification": {
152
+ "type": "string",
153
+ "description": "Data classification level for the service.",
154
+ "enum": ["public", "internal", "confidential", "restricted"]
155
+ }
156
+ },
157
+ "additionalProperties": false
158
+ }