@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,172 +1,172 @@
1
- {
2
- "$schema": "https://json-schema.org/draft/2020-12/schema",
3
- "$id": "https://unispec.dev/schema/types/graphql.schema.json",
4
- "title": "GraphQL API surface",
5
- "type": "object",
6
- "$defs": {
7
- "Argument": {
8
- "type": "object",
9
- "required": ["name", "type"],
10
- "properties": {
11
- "name": {
12
- "type": "string",
13
- "description": "Argument name as it appears in the GraphQL operation."
14
- },
15
- "type": {
16
- "type": "string",
17
- "description": "GraphQL type string (e.g., 'ID!', '[User]', 'PostFilter')."
18
- },
19
- "description": {
20
- "type": "string",
21
- "description": "Human-readable description of the argument."
22
- },
23
- "defaultValue": {
24
- "description": "Default value for the argument (any JSON value)."
25
- },
26
- "deprecated": {
27
- "type": "boolean",
28
- "description": "Marks the argument as deprecated.",
29
- "default": false
30
- },
31
- "deprecationReason": {
32
- "type": "string",
33
- "description": "Human-readable reason for deprecation."
34
- }
35
- },
36
- "additionalProperties": false
37
- },
38
- "SecurityRequirement": {
39
- "type": "array",
40
- "description": "Alternative set of named security schemes applied to an operation.",
41
- "items": {
42
- "$ref": "./common.schema.json#/$defs/Identifier"
43
- }
44
- },
45
- "Header": {
46
- "type": "object",
47
- "required": ["name"],
48
- "properties": {
49
- "name": {
50
- "type": "string",
51
- "description": "Header name (case-insensitive)."
52
- },
53
- "description": {
54
- "type": "string",
55
- "description": "Human-readable description of the header."
56
- },
57
- "required": {
58
- "type": "boolean",
59
- "description": "Whether this header is required.",
60
- "default": false
61
- },
62
- "defaultValue": {
63
- "type": "string",
64
- "description": "Default value for the header."
65
- }
66
- },
67
- "additionalProperties": false
68
- },
69
- "Operation": {
70
- "type": "object",
71
- "required": ["name"],
72
- "properties": {
73
- "name": {
74
- "$ref": "./common.schema.json#/$defs/Identifier"
75
- },
76
- "description": {
77
- "$ref": "./common.schema.json#/$defs/Description"
78
- },
79
- "tags": {
80
- "type": "array",
81
- "description": "Tags for grouping operations.",
82
- "items": {
83
- "$ref": "./common.schema.json#/$defs/Tag"
84
- }
85
- },
86
- "deprecated": {
87
- "type": "boolean",
88
- "description": "Marks the operation as deprecated.",
89
- "default": false
90
- },
91
- "deprecationReason": {
92
- "type": "string",
93
- "description": "Human-readable reason for deprecation."
94
- },
95
- "args": {
96
- "type": "array",
97
- "description": "Arguments for this GraphQL operation.",
98
- "items": {
99
- "$ref": "#/$defs/Argument"
100
- }
101
- },
102
- "returnType": {
103
- "type": "string",
104
- "description": "GraphQL return type (e.g., 'User!', '[User]')."
105
- },
106
- "headers": {
107
- "type": "array",
108
- "description": "HTTP headers relevant for this operation.",
109
- "items": {
110
- "$ref": "#/$defs/Header"
111
- }
112
- },
113
- "security": {
114
- "type": "array",
115
- "description": "Security requirements for this operation. Each item represents an alternative set of named security schemes.",
116
- "items": {
117
- "$ref": "#/$defs/SecurityRequirement"
118
- }
119
- }
120
- },
121
- "additionalProperties": false
122
- }
123
- },
124
- "properties": {
125
- "url": {
126
- "type": "string",
127
- "description": "Optional path or URL of the GraphQL endpoint. Recommended: relative path (e.g. '/graphql'). Absolute URLs are allowed only if the service is tightly bound to a single host. If omitted, tooling may assume a framework default (commonly '/graphql')."
128
- },
129
- "schema": {
130
- "type": "string",
131
- "description": "GraphQL schema SDL as a string. Canonical source of type definitions."
132
- },
133
- "securitySchemes": {
134
- "type": "object",
135
- "description": "Authentication mechanisms available for this GraphQL surface.",
136
- "additionalProperties": {
137
- "type": "object",
138
- "description": "Security scheme definition (shape is intentionally flexible and may evolve).",
139
- "additionalProperties": true
140
- }
141
- },
142
- "headers": {
143
- "type": "array",
144
- "description": "HTTP headers commonly used for GraphQL requests.",
145
- "items": {
146
- "$ref": "#/$defs/Header"
147
- }
148
- },
149
- "queries": {
150
- "type": "array",
151
- "description": "Query operations exposed by the GraphQL API.",
152
- "items": {
153
- "$ref": "#/$defs/Operation"
154
- }
155
- },
156
- "mutations": {
157
- "type": "array",
158
- "description": "Mutation operations exposed by the GraphQL API.",
159
- "items": {
160
- "$ref": "#/$defs/Operation"
161
- }
162
- },
163
- "subscriptions": {
164
- "type": "array",
165
- "description": "Subscription operations exposed by the GraphQL API.",
166
- "items": {
167
- "$ref": "#/$defs/Operation"
168
- }
169
- }
170
- },
171
- "additionalProperties": false
172
- }
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://unispec.dev/schema/types/graphql.schema.json",
4
+ "title": "GraphQL API surface",
5
+ "type": "object",
6
+ "$defs": {
7
+ "Argument": {
8
+ "type": "object",
9
+ "required": ["name", "type"],
10
+ "properties": {
11
+ "name": {
12
+ "type": "string",
13
+ "description": "Argument name as it appears in the GraphQL operation."
14
+ },
15
+ "type": {
16
+ "type": "string",
17
+ "description": "GraphQL type string (e.g., 'ID!', '[User]', 'PostFilter')."
18
+ },
19
+ "description": {
20
+ "type": "string",
21
+ "description": "Human-readable description of the argument."
22
+ },
23
+ "defaultValue": {
24
+ "description": "Default value for the argument (any JSON value)."
25
+ },
26
+ "deprecated": {
27
+ "type": "boolean",
28
+ "description": "Marks the argument as deprecated.",
29
+ "default": false
30
+ },
31
+ "deprecationReason": {
32
+ "type": "string",
33
+ "description": "Human-readable reason for deprecation."
34
+ }
35
+ },
36
+ "additionalProperties": false
37
+ },
38
+ "SecurityRequirement": {
39
+ "type": "array",
40
+ "description": "Alternative set of named security schemes applied to an operation.",
41
+ "items": {
42
+ "$ref": "./common.schema.json#/$defs/Identifier"
43
+ }
44
+ },
45
+ "Header": {
46
+ "type": "object",
47
+ "required": ["name"],
48
+ "properties": {
49
+ "name": {
50
+ "type": "string",
51
+ "description": "Header name (case-insensitive)."
52
+ },
53
+ "description": {
54
+ "type": "string",
55
+ "description": "Human-readable description of the header."
56
+ },
57
+ "required": {
58
+ "type": "boolean",
59
+ "description": "Whether this header is required.",
60
+ "default": false
61
+ },
62
+ "defaultValue": {
63
+ "type": "string",
64
+ "description": "Default value for the header."
65
+ }
66
+ },
67
+ "additionalProperties": false
68
+ },
69
+ "Operation": {
70
+ "type": "object",
71
+ "required": ["name"],
72
+ "properties": {
73
+ "name": {
74
+ "$ref": "./common.schema.json#/$defs/Identifier"
75
+ },
76
+ "description": {
77
+ "$ref": "./common.schema.json#/$defs/Description"
78
+ },
79
+ "tags": {
80
+ "type": "array",
81
+ "description": "Tags for grouping operations.",
82
+ "items": {
83
+ "$ref": "./common.schema.json#/$defs/Tag"
84
+ }
85
+ },
86
+ "deprecated": {
87
+ "type": "boolean",
88
+ "description": "Marks the operation as deprecated.",
89
+ "default": false
90
+ },
91
+ "deprecationReason": {
92
+ "type": "string",
93
+ "description": "Human-readable reason for deprecation."
94
+ },
95
+ "args": {
96
+ "type": "array",
97
+ "description": "Arguments for this GraphQL operation.",
98
+ "items": {
99
+ "$ref": "#/$defs/Argument"
100
+ }
101
+ },
102
+ "returnType": {
103
+ "type": "string",
104
+ "description": "GraphQL return type (e.g., 'User!', '[User]')."
105
+ },
106
+ "headers": {
107
+ "type": "array",
108
+ "description": "HTTP headers relevant for this operation.",
109
+ "items": {
110
+ "$ref": "#/$defs/Header"
111
+ }
112
+ },
113
+ "security": {
114
+ "type": "array",
115
+ "description": "Security requirements for this operation. Each item represents an alternative set of named security schemes.",
116
+ "items": {
117
+ "$ref": "#/$defs/SecurityRequirement"
118
+ }
119
+ }
120
+ },
121
+ "additionalProperties": false
122
+ }
123
+ },
124
+ "properties": {
125
+ "url": {
126
+ "type": "string",
127
+ "description": "Optional path or URL of the GraphQL endpoint. Recommended: relative path (e.g. '/graphql'). Absolute URLs are allowed only if the service is tightly bound to a single host. If omitted, tooling may assume a framework default (commonly '/graphql')."
128
+ },
129
+ "schema": {
130
+ "type": "string",
131
+ "description": "GraphQL schema SDL as a string. Canonical source of type definitions."
132
+ },
133
+ "securitySchemes": {
134
+ "type": "object",
135
+ "description": "Authentication mechanisms available for this GraphQL surface.",
136
+ "additionalProperties": {
137
+ "type": "object",
138
+ "description": "Security scheme definition (shape is intentionally flexible and may evolve).",
139
+ "additionalProperties": true
140
+ }
141
+ },
142
+ "headers": {
143
+ "type": "array",
144
+ "description": "HTTP headers commonly used for GraphQL requests.",
145
+ "items": {
146
+ "$ref": "#/$defs/Header"
147
+ }
148
+ },
149
+ "queries": {
150
+ "type": "array",
151
+ "description": "Query operations exposed by the GraphQL API.",
152
+ "items": {
153
+ "$ref": "#/$defs/Operation"
154
+ }
155
+ },
156
+ "mutations": {
157
+ "type": "array",
158
+ "description": "Mutation operations exposed by the GraphQL API.",
159
+ "items": {
160
+ "$ref": "#/$defs/Operation"
161
+ }
162
+ },
163
+ "subscriptions": {
164
+ "type": "array",
165
+ "description": "Subscription operations exposed by the GraphQL API.",
166
+ "items": {
167
+ "$ref": "#/$defs/Operation"
168
+ }
169
+ }
170
+ },
171
+ "additionalProperties": false
172
+ }