@unispechq/unispec-schema 0.3.1 → 0.3.4
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/README.md +195 -166
- package/index.cjs +7 -7
- package/index.d.ts +9 -9
- package/index.mjs +9 -9
- package/package.json +8 -1
- package/schema/index.json +14 -14
- package/schema/types/common.schema.json +16 -16
- package/schema/types/graphql.schema.json +58 -58
- package/schema/types/rest.schema.json +167 -167
- package/schema/types/schemas.schema.json +25 -25
- package/schema/types/service.schema.json +39 -96
- package/schema/types/websocket.schema.json +89 -89
- package/schema/unispec-tests.schema.json +318 -318
- package/schema/unispec.schema.json +23 -23
|
@@ -1,167 +1,167 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://unispec.dev/schema/types/rest.schema.json",
|
|
4
|
-
"title": "REST API surface",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"$defs": {
|
|
7
|
-
"Route": {
|
|
8
|
-
"type": "object",
|
|
9
|
-
"required": ["path", "method"],
|
|
10
|
-
"properties": {
|
|
11
|
-
"name": {
|
|
12
|
-
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
13
|
-
},
|
|
14
|
-
"summary": {
|
|
15
|
-
"type": "string",
|
|
16
|
-
"description": "Short, human-readable summary of the route."
|
|
17
|
-
},
|
|
18
|
-
"description": {
|
|
19
|
-
"$ref": "./common.schema.json#/$defs/Description"
|
|
20
|
-
},
|
|
21
|
-
"path": {
|
|
22
|
-
"type": "string",
|
|
23
|
-
"description": "URL path template, e.g. /users/{id}."
|
|
24
|
-
},
|
|
25
|
-
"method": {
|
|
26
|
-
"type": "string",
|
|
27
|
-
"description": "HTTP method in upper-case.",
|
|
28
|
-
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE"]
|
|
29
|
-
},
|
|
30
|
-
"pathParams": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"description": "Path parameters bound from the URL template.",
|
|
33
|
-
"items": {
|
|
34
|
-
"$ref": "#/$defs/Parameter"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"queryParams": {
|
|
38
|
-
"type": "array",
|
|
39
|
-
"description": "Query string parameters.",
|
|
40
|
-
"items": {
|
|
41
|
-
"$ref": "#/$defs/Parameter"
|
|
42
|
-
}
|
|
43
|
-
},
|
|
44
|
-
"headers": {
|
|
45
|
-
"type": "array",
|
|
46
|
-
"description": "HTTP headers relevant for this route.",
|
|
47
|
-
"items": {
|
|
48
|
-
"$ref": "#/$defs/Parameter"
|
|
49
|
-
}
|
|
50
|
-
},
|
|
51
|
-
"requestBody": {
|
|
52
|
-
"$ref": "#/$defs/RequestBody"
|
|
53
|
-
},
|
|
54
|
-
"responses": {
|
|
55
|
-
"type": "object",
|
|
56
|
-
"description": "HTTP responses keyed by status code (e.g. '200', '404').",
|
|
57
|
-
"additionalProperties": {
|
|
58
|
-
"$ref": "#/$defs/Response"
|
|
59
|
-
}
|
|
60
|
-
},
|
|
61
|
-
"security": {
|
|
62
|
-
"type": "array",
|
|
63
|
-
"description": "Security requirements for this route. Each item represents an alternative set of named security schemes.",
|
|
64
|
-
"items": {
|
|
65
|
-
"$ref": "#/$defs/SecurityRequirement"
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"additionalProperties": false
|
|
70
|
-
},
|
|
71
|
-
"SecurityRequirement": {
|
|
72
|
-
"type": "array",
|
|
73
|
-
"description": "Alternative set of named security schemes applied to an operation.",
|
|
74
|
-
"items": {
|
|
75
|
-
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
"Parameter": {
|
|
79
|
-
"type": "object",
|
|
80
|
-
"required": ["name"],
|
|
81
|
-
"properties": {
|
|
82
|
-
"name": {
|
|
83
|
-
"type": "string",
|
|
84
|
-
"description": "Parameter name as it appears in the API."
|
|
85
|
-
},
|
|
86
|
-
"description": {
|
|
87
|
-
"$ref": "./common.schema.json#/$defs/Description"
|
|
88
|
-
},
|
|
89
|
-
"required": {
|
|
90
|
-
"type": "boolean",
|
|
91
|
-
"description": "Whether this parameter is required.",
|
|
92
|
-
"default": false
|
|
93
|
-
},
|
|
94
|
-
"schemaRef": {
|
|
95
|
-
"type": "string",
|
|
96
|
-
"description": "Reference to a reusable schema defined in the service
|
|
97
|
-
}
|
|
98
|
-
},
|
|
99
|
-
"additionalProperties": false
|
|
100
|
-
},
|
|
101
|
-
"MediaType": {
|
|
102
|
-
"type": "object",
|
|
103
|
-
"properties": {
|
|
104
|
-
"schemaRef": {
|
|
105
|
-
"type": "string",
|
|
106
|
-
"description": "Reference to a reusable schema used as the content payload."
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
"additionalProperties": false
|
|
110
|
-
},
|
|
111
|
-
"Content": {
|
|
112
|
-
"type": "object",
|
|
113
|
-
"description": "Content keyed by media type, e.g. 'application/json'.",
|
|
114
|
-
"additionalProperties": {
|
|
115
|
-
"$ref": "#/$defs/MediaType"
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
"RequestBody": {
|
|
119
|
-
"type": "object",
|
|
120
|
-
"properties": {
|
|
121
|
-
"description": {
|
|
122
|
-
"$ref": "./common.schema.json#/$defs/Description"
|
|
123
|
-
},
|
|
124
|
-
"required": {
|
|
125
|
-
"type": "boolean",
|
|
126
|
-
"description": "Whether a request body is required.",
|
|
127
|
-
"default": false
|
|
128
|
-
},
|
|
129
|
-
"content": {
|
|
130
|
-
"$ref": "#/$defs/Content"
|
|
131
|
-
}
|
|
132
|
-
},
|
|
133
|
-
"additionalProperties": false
|
|
134
|
-
},
|
|
135
|
-
"Response": {
|
|
136
|
-
"type": "object",
|
|
137
|
-
"properties": {
|
|
138
|
-
"description": {
|
|
139
|
-
"$ref": "./common.schema.json#/$defs/Description"
|
|
140
|
-
},
|
|
141
|
-
"content": {
|
|
142
|
-
"$ref": "#/$defs/Content"
|
|
143
|
-
}
|
|
144
|
-
},
|
|
145
|
-
"additionalProperties": false
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
"properties": {
|
|
149
|
-
"routes": {
|
|
150
|
-
"type": "array",
|
|
151
|
-
"description": "List of REST routes exposed by the service.",
|
|
152
|
-
"items": {
|
|
153
|
-
"$ref": "#/$defs/Route"
|
|
154
|
-
}
|
|
155
|
-
},
|
|
156
|
-
"securitySchemes": {
|
|
157
|
-
"type": "object",
|
|
158
|
-
"description": "Authentication mechanisms available for this REST surface.",
|
|
159
|
-
"additionalProperties": {
|
|
160
|
-
"type": "object",
|
|
161
|
-
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
162
|
-
"additionalProperties": true
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"additionalProperties": false
|
|
167
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unispec.dev/schema/types/rest.schema.json",
|
|
4
|
+
"title": "REST API surface",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"$defs": {
|
|
7
|
+
"Route": {
|
|
8
|
+
"type": "object",
|
|
9
|
+
"required": ["path", "method"],
|
|
10
|
+
"properties": {
|
|
11
|
+
"name": {
|
|
12
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
13
|
+
},
|
|
14
|
+
"summary": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Short, human-readable summary of the route."
|
|
17
|
+
},
|
|
18
|
+
"description": {
|
|
19
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
20
|
+
},
|
|
21
|
+
"path": {
|
|
22
|
+
"type": "string",
|
|
23
|
+
"description": "URL path template, e.g. /users/{id}."
|
|
24
|
+
},
|
|
25
|
+
"method": {
|
|
26
|
+
"type": "string",
|
|
27
|
+
"description": "HTTP method in upper-case.",
|
|
28
|
+
"enum": ["GET", "POST", "PUT", "PATCH", "DELETE"]
|
|
29
|
+
},
|
|
30
|
+
"pathParams": {
|
|
31
|
+
"type": "array",
|
|
32
|
+
"description": "Path parameters bound from the URL template.",
|
|
33
|
+
"items": {
|
|
34
|
+
"$ref": "#/$defs/Parameter"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"queryParams": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"description": "Query string parameters.",
|
|
40
|
+
"items": {
|
|
41
|
+
"$ref": "#/$defs/Parameter"
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
"headers": {
|
|
45
|
+
"type": "array",
|
|
46
|
+
"description": "HTTP headers relevant for this route.",
|
|
47
|
+
"items": {
|
|
48
|
+
"$ref": "#/$defs/Parameter"
|
|
49
|
+
}
|
|
50
|
+
},
|
|
51
|
+
"requestBody": {
|
|
52
|
+
"$ref": "#/$defs/RequestBody"
|
|
53
|
+
},
|
|
54
|
+
"responses": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"description": "HTTP responses keyed by status code (e.g. '200', '404').",
|
|
57
|
+
"additionalProperties": {
|
|
58
|
+
"$ref": "#/$defs/Response"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
"security": {
|
|
62
|
+
"type": "array",
|
|
63
|
+
"description": "Security requirements for this route. Each item represents an alternative set of named security schemes.",
|
|
64
|
+
"items": {
|
|
65
|
+
"$ref": "#/$defs/SecurityRequirement"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
"additionalProperties": false
|
|
70
|
+
},
|
|
71
|
+
"SecurityRequirement": {
|
|
72
|
+
"type": "array",
|
|
73
|
+
"description": "Alternative set of named security schemes applied to an operation.",
|
|
74
|
+
"items": {
|
|
75
|
+
"$ref": "./common.schema.json#/$defs/Identifier"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"Parameter": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"required": ["name"],
|
|
81
|
+
"properties": {
|
|
82
|
+
"name": {
|
|
83
|
+
"type": "string",
|
|
84
|
+
"description": "Parameter name as it appears in the API."
|
|
85
|
+
},
|
|
86
|
+
"description": {
|
|
87
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
88
|
+
},
|
|
89
|
+
"required": {
|
|
90
|
+
"type": "boolean",
|
|
91
|
+
"description": "Whether this parameter is required.",
|
|
92
|
+
"default": false
|
|
93
|
+
},
|
|
94
|
+
"schemaRef": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Reference to a reusable schema defined in service.schemas. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
"additionalProperties": false
|
|
100
|
+
},
|
|
101
|
+
"MediaType": {
|
|
102
|
+
"type": "object",
|
|
103
|
+
"properties": {
|
|
104
|
+
"schemaRef": {
|
|
105
|
+
"type": "string",
|
|
106
|
+
"description": "Reference to a reusable schema defined in service.schemas used as the content payload. Recommended format: <SchemaName> (where SchemaName is a key in service.schemas). Tools may also accept a JSON Pointer in the form #/service/schemas/<SchemaName>."
|
|
107
|
+
}
|
|
108
|
+
},
|
|
109
|
+
"additionalProperties": false
|
|
110
|
+
},
|
|
111
|
+
"Content": {
|
|
112
|
+
"type": "object",
|
|
113
|
+
"description": "Content keyed by media type, e.g. 'application/json'.",
|
|
114
|
+
"additionalProperties": {
|
|
115
|
+
"$ref": "#/$defs/MediaType"
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
"RequestBody": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"properties": {
|
|
121
|
+
"description": {
|
|
122
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
123
|
+
},
|
|
124
|
+
"required": {
|
|
125
|
+
"type": "boolean",
|
|
126
|
+
"description": "Whether a request body is required.",
|
|
127
|
+
"default": false
|
|
128
|
+
},
|
|
129
|
+
"content": {
|
|
130
|
+
"$ref": "#/$defs/Content"
|
|
131
|
+
}
|
|
132
|
+
},
|
|
133
|
+
"additionalProperties": false
|
|
134
|
+
},
|
|
135
|
+
"Response": {
|
|
136
|
+
"type": "object",
|
|
137
|
+
"properties": {
|
|
138
|
+
"description": {
|
|
139
|
+
"$ref": "./common.schema.json#/$defs/Description"
|
|
140
|
+
},
|
|
141
|
+
"content": {
|
|
142
|
+
"$ref": "#/$defs/Content"
|
|
143
|
+
}
|
|
144
|
+
},
|
|
145
|
+
"additionalProperties": false
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"properties": {
|
|
149
|
+
"routes": {
|
|
150
|
+
"type": "array",
|
|
151
|
+
"description": "List of REST routes exposed by the service.",
|
|
152
|
+
"items": {
|
|
153
|
+
"$ref": "#/$defs/Route"
|
|
154
|
+
}
|
|
155
|
+
},
|
|
156
|
+
"securitySchemes": {
|
|
157
|
+
"type": "object",
|
|
158
|
+
"description": "Authentication mechanisms available for this REST surface.",
|
|
159
|
+
"additionalProperties": {
|
|
160
|
+
"type": "object",
|
|
161
|
+
"description": "Security scheme definition (shape is intentionally flexible and may evolve).",
|
|
162
|
+
"additionalProperties": true
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
},
|
|
166
|
+
"additionalProperties": false
|
|
167
|
+
}
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
-
"$id": "https://unispec.dev/schema/types/schemas.schema.json",
|
|
4
|
-
"title": "Reusable data schemas",
|
|
5
|
-
"description": "Container for reusable data model definitions (request/response bodies, messages, etc.).",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"additionalProperties": {
|
|
8
|
-
"$ref": "#/$defs/SchemaDefinition"
|
|
9
|
-
},
|
|
10
|
-
"$defs": {
|
|
11
|
-
"SchemaDefinition": {
|
|
12
|
-
"type": "object",
|
|
13
|
-
"description": "Named reusable data schema definition.",
|
|
14
|
-
"properties": {
|
|
15
|
-
"jsonSchema": {
|
|
16
|
-
"type": "object",
|
|
17
|
-
"description": "Embedded JSON Schema Draft 2020-12 definition for this type.",
|
|
18
|
-
"additionalProperties": true
|
|
19
|
-
}
|
|
20
|
-
},
|
|
21
|
-
"required": ["jsonSchema"],
|
|
22
|
-
"additionalProperties": false
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "https://unispec.dev/schema/types/schemas.schema.json",
|
|
4
|
+
"title": "Reusable data schemas",
|
|
5
|
+
"description": "Container for reusable data model definitions (request/response bodies, messages, etc.).",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": {
|
|
8
|
+
"$ref": "#/$defs/SchemaDefinition"
|
|
9
|
+
},
|
|
10
|
+
"$defs": {
|
|
11
|
+
"SchemaDefinition": {
|
|
12
|
+
"type": "object",
|
|
13
|
+
"description": "Named reusable data schema definition.",
|
|
14
|
+
"properties": {
|
|
15
|
+
"jsonSchema": {
|
|
16
|
+
"type": "object",
|
|
17
|
+
"description": "Embedded JSON Schema Draft 2020-12 definition for this type.",
|
|
18
|
+
"additionalProperties": true
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["jsonSchema"],
|
|
22
|
+
"additionalProperties": false
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -1,96 +1,39 @@
|
|
|
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
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
},
|
|
18
|
-
"
|
|
19
|
-
"type": "
|
|
20
|
-
"description": "
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
"protocols": {
|
|
41
|
-
"type": "object",
|
|
42
|
-
"description": "Protocol-specific API surfaces exposed by this service.",
|
|
43
|
-
"properties": {
|
|
44
|
-
"rest": {
|
|
45
|
-
"$ref": "./rest.schema.json#"
|
|
46
|
-
},
|
|
47
|
-
"graphql": {
|
|
48
|
-
"$ref": "./graphql.schema.json#"
|
|
49
|
-
},
|
|
50
|
-
"websocket": {
|
|
51
|
-
"$ref": "./websocket.schema.json#"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
"additionalProperties": false
|
|
55
|
-
},
|
|
56
|
-
"schemas": {
|
|
57
|
-
"$ref": "./schemas.schema.json#"
|
|
58
|
-
},
|
|
59
|
-
"environments": {
|
|
60
|
-
"type": "array",
|
|
61
|
-
"description": "Deployment environments or entrypoints for the service.",
|
|
62
|
-
"items": {
|
|
63
|
-
"type": "object",
|
|
64
|
-
"required": ["name", "baseUrl"],
|
|
65
|
-
"properties": {
|
|
66
|
-
"name": {
|
|
67
|
-
"type": "string",
|
|
68
|
-
"description": "Short environment name (for example, dev, staging, prod, local)."
|
|
69
|
-
},
|
|
70
|
-
"baseUrl": {
|
|
71
|
-
"type": "string",
|
|
72
|
-
"format": "uri",
|
|
73
|
-
"description": "Base URL for the environment."
|
|
74
|
-
},
|
|
75
|
-
"region": {
|
|
76
|
-
"type": "string",
|
|
77
|
-
"description": "Region identifier (for example, eu-central-1)."
|
|
78
|
-
},
|
|
79
|
-
"labels": {
|
|
80
|
-
"type": "object",
|
|
81
|
-
"description": "Arbitrary string labels for tooling.",
|
|
82
|
-
"additionalProperties": {
|
|
83
|
-
"type": "string"
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
"isDefault": {
|
|
87
|
-
"type": "boolean",
|
|
88
|
-
"description": "Indicates the default environment for interactive tooling."
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"additionalProperties": false
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
},
|
|
95
|
-
"additionalProperties": false
|
|
96
|
-
}
|
|
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
|
+
"type": "string",
|
|
16
|
+
"description": "Service contract version (SemVer)."
|
|
17
|
+
},
|
|
18
|
+
"protocols": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "Protocol-specific API surfaces exposed by this service.",
|
|
21
|
+
"properties": {
|
|
22
|
+
"rest": {
|
|
23
|
+
"$ref": "./rest.schema.json#"
|
|
24
|
+
},
|
|
25
|
+
"graphql": {
|
|
26
|
+
"$ref": "./graphql.schema.json#"
|
|
27
|
+
},
|
|
28
|
+
"websocket": {
|
|
29
|
+
"$ref": "./websocket.schema.json#"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"additionalProperties": false
|
|
33
|
+
},
|
|
34
|
+
"schemas": {
|
|
35
|
+
"$ref": "./schemas.schema.json#"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
"additionalProperties": false
|
|
39
|
+
}
|