@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
package/schema/index.json CHANGED
@@ -1,19 +1,19 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "name": "@unispechq/unispec-schema",
4
- "description": "Official UniSpec JSON Schemas",
5
- "root": "./unispec.schema.json",
6
- "types": {
7
- "common": "./types/common.schema.json",
8
- "graphql": "./types/graphql.schema.json",
9
- "rest": "./types/rest.schema.json",
10
- "schemas": "./types/schemas.schema.json",
11
- "service": "./types/service.schema.json",
12
- "websocket": "./types/websocket.schema.json"
13
- },
14
- "documents": {
15
- "unispec": "./unispec.schema.json",
16
- "unispecTests": "./unispec-tests.schema.json",
17
- "unispecConfig": "./unispec-config.schema.json"
18
- }
19
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "name": "@unispechq/unispec-schema",
4
+ "description": "Official UniSpec JSON Schemas",
5
+ "root": "./unispec.schema.json",
6
+ "types": {
7
+ "common": "./types/common.schema.json",
8
+ "graphql": "./types/graphql.schema.json",
9
+ "rest": "./types/rest.schema.json",
10
+ "schemas": "./types/schemas.schema.json",
11
+ "service": "./types/service.schema.json",
12
+ "websocket": "./types/websocket.schema.json"
13
+ },
14
+ "documents": {
15
+ "unispec": "./unispec.schema.json",
16
+ "unispecTests": "./unispec-tests.schema.json",
17
+ "unispecConfig": "./unispec-config.schema.json"
18
+ }
19
+ }
@@ -1,195 +1,195 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/types/common.schema.json",
4
- "title": "Common UniSpec definitions",
5
- "$defs": {
6
- "Identifier": {
7
- "type": "string",
8
- "description": "Identifier for services, operations, channels, etc.",
9
- "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]*$"
10
- },
11
- "Description": {
12
- "type": "string",
13
- "description": "Human-readable description text."
14
- },
15
- "Email": {
16
- "type": "string",
17
- "description": "Email address with validation.",
18
- "format": "email",
19
- "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
20
- },
21
- "Url": {
22
- "type": "string",
23
- "description": "URL with validation.",
24
- "format": "uri",
25
- "pattern": "^https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}.*$"
26
- },
27
- "Version": {
28
- "type": "string",
29
- "description": "Semantic version string (SemVer).",
30
- "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
31
- },
32
- "Tag": {
33
- "type": "string",
34
- "description": "Tag for grouping operations and resources.",
35
- "pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
36
- },
37
- "SecurityScheme": {
38
- "type": "object",
39
- "discriminator": {
40
- "propertyName": "type"
41
- },
42
- "oneOf": [
43
- {
44
- "$ref": "#/$defs/ApiKeyScheme"
45
- },
46
- {
47
- "$ref": "#/$defs/HttpScheme"
48
- },
49
- {
50
- "$ref": "#/$defs/OAuth2Scheme"
51
- },
52
- {
53
- "$ref": "#/$defs/JwtScheme"
54
- }
55
- ]
56
- },
57
- "ApiKeyScheme": {
58
- "type": "object",
59
- "properties": {
60
- "type": {
61
- "const": "apiKey"
62
- },
63
- "name": {
64
- "type": "string",
65
- "description": "Name of the API key header or query parameter."
66
- },
67
- "in": {
68
- "type": "string",
69
- "enum": ["header", "query", "cookie"],
70
- "description": "Location of the API key."
71
- },
72
- "description": {
73
- "type": "string",
74
- "description": "Description of the API key usage."
75
- }
76
- },
77
- "required": ["type", "name", "in"],
78
- "additionalProperties": false
79
- },
80
- "HttpScheme": {
81
- "type": "object",
82
- "properties": {
83
- "type": {
84
- "const": "http"
85
- },
86
- "scheme": {
87
- "type": "string",
88
- "enum": ["basic", "bearer", "digest"],
89
- "description": "HTTP authentication scheme."
90
- },
91
- "bearerFormat": {
92
- "type": "string",
93
- "description": "Format of the bearer token (e.g., JWT)."
94
- },
95
- "description": {
96
- "type": "string",
97
- "description": "Description of the HTTP authentication scheme."
98
- }
99
- },
100
- "required": ["type", "scheme"],
101
- "additionalProperties": false
102
- },
103
- "OAuth2Scheme": {
104
- "type": "object",
105
- "properties": {
106
- "type": {
107
- "const": "oauth2"
108
- },
109
- "flows": {
110
- "type": "object",
111
- "description": "OAuth2 authorization flows.",
112
- "properties": {
113
- "authorizationCode": {
114
- "$ref": "#/$defs/OAuth2Flow"
115
- },
116
- "clientCredentials": {
117
- "$ref": "#/$defs/OAuth2Flow"
118
- },
119
- "implicit": {
120
- "$ref": "#/$defs/OAuth2Flow"
121
- }
122
- },
123
- "additionalProperties": false
124
- },
125
- "description": {
126
- "type": "string",
127
- "description": "Description of the OAuth2 scheme."
128
- }
129
- },
130
- "required": ["type", "flows"],
131
- "additionalProperties": false
132
- },
133
- "JwtScheme": {
134
- "type": "object",
135
- "properties": {
136
- "type": {
137
- "const": "jwt"
138
- },
139
- "issuer": {
140
- "type": "string",
141
- "description": "JWT issuer URL."
142
- },
143
- "audience": {
144
- "type": "array",
145
- "items": {
146
- "type": "string"
147
- },
148
- "description": "Allowed JWT audiences."
149
- },
150
- "algorithms": {
151
- "type": "array",
152
- "items": {
153
- "type": "string"
154
- },
155
- "description": "Allowed JWT algorithms."
156
- },
157
- "description": {
158
- "type": "string",
159
- "description": "Description of the JWT scheme."
160
- }
161
- },
162
- "required": ["type"],
163
- "additionalProperties": false
164
- },
165
- "OAuth2Flow": {
166
- "type": "object",
167
- "properties": {
168
- "authorizationUrl": {
169
- "type": "string",
170
- "format": "uri",
171
- "description": "Authorization URL."
172
- },
173
- "tokenUrl": {
174
- "type": "string",
175
- "format": "uri",
176
- "description": "Token URL."
177
- },
178
- "refreshUrl": {
179
- "type": "string",
180
- "format": "uri",
181
- "description": "Refresh token URL."
182
- },
183
- "scopes": {
184
- "type": "object",
185
- "description": "Available scopes.",
186
- "additionalProperties": {
187
- "type": "string"
188
- }
189
- }
190
- },
191
- "required": ["authorizationUrl", "tokenUrl", "scopes"],
192
- "additionalProperties": false
193
- }
194
- }
195
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/types/common.schema.json",
4
+ "title": "Common UniSpec definitions",
5
+ "$defs": {
6
+ "Identifier": {
7
+ "type": "string",
8
+ "description": "Identifier for services, operations, channels, etc.",
9
+ "pattern": "^[A-Za-z_][A-Za-z0-9_.:-]*$"
10
+ },
11
+ "Description": {
12
+ "type": "string",
13
+ "description": "Human-readable description text."
14
+ },
15
+ "Email": {
16
+ "type": "string",
17
+ "description": "Email address with validation.",
18
+ "format": "email",
19
+ "pattern": "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$"
20
+ },
21
+ "Url": {
22
+ "type": "string",
23
+ "description": "URL with validation.",
24
+ "format": "uri",
25
+ "pattern": "^https?://[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}.*$"
26
+ },
27
+ "Version": {
28
+ "type": "string",
29
+ "description": "Semantic version string (SemVer).",
30
+ "pattern": "^(0|[1-9]\\d*)\\.(0|[1-9]\\d*)\\.(0|[1-9]\\d*)(?:-((?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\.(?:0|[1-9]\\d*|\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\+([0-9a-zA-Z-]+(?:\\.[0-9a-zA-Z-]+)*))?$"
31
+ },
32
+ "Tag": {
33
+ "type": "string",
34
+ "description": "Tag for grouping operations and resources.",
35
+ "pattern": "^[A-Za-z][A-Za-z0-9_-]*$"
36
+ },
37
+ "SecurityScheme": {
38
+ "type": "object",
39
+ "discriminator": {
40
+ "propertyName": "type"
41
+ },
42
+ "oneOf": [
43
+ {
44
+ "$ref": "#/$defs/ApiKeyScheme"
45
+ },
46
+ {
47
+ "$ref": "#/$defs/HttpScheme"
48
+ },
49
+ {
50
+ "$ref": "#/$defs/OAuth2Scheme"
51
+ },
52
+ {
53
+ "$ref": "#/$defs/JwtScheme"
54
+ }
55
+ ]
56
+ },
57
+ "ApiKeyScheme": {
58
+ "type": "object",
59
+ "properties": {
60
+ "type": {
61
+ "const": "apiKey"
62
+ },
63
+ "name": {
64
+ "type": "string",
65
+ "description": "Name of the API key header or query parameter."
66
+ },
67
+ "in": {
68
+ "type": "string",
69
+ "enum": ["header", "query", "cookie"],
70
+ "description": "Location of the API key."
71
+ },
72
+ "description": {
73
+ "type": "string",
74
+ "description": "Description of the API key usage."
75
+ }
76
+ },
77
+ "required": ["type", "name", "in"],
78
+ "additionalProperties": false
79
+ },
80
+ "HttpScheme": {
81
+ "type": "object",
82
+ "properties": {
83
+ "type": {
84
+ "const": "http"
85
+ },
86
+ "scheme": {
87
+ "type": "string",
88
+ "enum": ["basic", "bearer", "digest"],
89
+ "description": "HTTP authentication scheme."
90
+ },
91
+ "bearerFormat": {
92
+ "type": "string",
93
+ "description": "Format of the bearer token (e.g., JWT)."
94
+ },
95
+ "description": {
96
+ "type": "string",
97
+ "description": "Description of the HTTP authentication scheme."
98
+ }
99
+ },
100
+ "required": ["type", "scheme"],
101
+ "additionalProperties": false
102
+ },
103
+ "OAuth2Scheme": {
104
+ "type": "object",
105
+ "properties": {
106
+ "type": {
107
+ "const": "oauth2"
108
+ },
109
+ "flows": {
110
+ "type": "object",
111
+ "description": "OAuth2 authorization flows.",
112
+ "properties": {
113
+ "authorizationCode": {
114
+ "$ref": "#/$defs/OAuth2Flow"
115
+ },
116
+ "clientCredentials": {
117
+ "$ref": "#/$defs/OAuth2Flow"
118
+ },
119
+ "implicit": {
120
+ "$ref": "#/$defs/OAuth2Flow"
121
+ }
122
+ },
123
+ "additionalProperties": false
124
+ },
125
+ "description": {
126
+ "type": "string",
127
+ "description": "Description of the OAuth2 scheme."
128
+ }
129
+ },
130
+ "required": ["type", "flows"],
131
+ "additionalProperties": false
132
+ },
133
+ "JwtScheme": {
134
+ "type": "object",
135
+ "properties": {
136
+ "type": {
137
+ "const": "jwt"
138
+ },
139
+ "issuer": {
140
+ "type": "string",
141
+ "description": "JWT issuer URL."
142
+ },
143
+ "audience": {
144
+ "type": "array",
145
+ "items": {
146
+ "type": "string"
147
+ },
148
+ "description": "Allowed JWT audiences."
149
+ },
150
+ "algorithms": {
151
+ "type": "array",
152
+ "items": {
153
+ "type": "string"
154
+ },
155
+ "description": "Allowed JWT algorithms."
156
+ },
157
+ "description": {
158
+ "type": "string",
159
+ "description": "Description of the JWT scheme."
160
+ }
161
+ },
162
+ "required": ["type"],
163
+ "additionalProperties": false
164
+ },
165
+ "OAuth2Flow": {
166
+ "type": "object",
167
+ "properties": {
168
+ "authorizationUrl": {
169
+ "type": "string",
170
+ "format": "uri",
171
+ "description": "Authorization URL."
172
+ },
173
+ "tokenUrl": {
174
+ "type": "string",
175
+ "format": "uri",
176
+ "description": "Token URL."
177
+ },
178
+ "refreshUrl": {
179
+ "type": "string",
180
+ "format": "uri",
181
+ "description": "Refresh token URL."
182
+ },
183
+ "scopes": {
184
+ "type": "object",
185
+ "description": "Available scopes.",
186
+ "additionalProperties": {
187
+ "type": "string"
188
+ }
189
+ }
190
+ },
191
+ "required": ["authorizationUrl", "tokenUrl", "scopes"],
192
+ "additionalProperties": false
193
+ }
194
+ }
195
+ }