Skip to content

Commit 47a3abc

Browse files
authored
Support for web specification source in Specmatic (SchemaStore#5569)
Co-authored-by: joelrosario <joelrosario@users.noreply.github.com>
1 parent 2fa3201 commit 47a3abc

5 files changed

Lines changed: 103 additions & 0 deletions

File tree

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"contracts": [
3+
{
4+
"web": {
5+
"url": 123
6+
}
7+
}
8+
],
9+
"version": 2
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"components": {
3+
"sources": {
4+
"remoteSpecs": {
5+
"web": {}
6+
}
7+
}
8+
},
9+
"version": 3
10+
}

src/schemas/json/specmatic.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,18 @@
251251
},
252252
"required": []
253253
},
254+
"web": {
255+
"type": "object",
256+
"description": "Web contract source details.",
257+
"additionalProperties": false,
258+
"required": ["url"],
259+
"properties": {
260+
"url": {
261+
"type": "string",
262+
"description": "Base URL for web-hosted contract files."
263+
}
264+
}
265+
},
254266
"provides": {
255267
"type": ["array", "null"],
256268
"description": "List of specs provided for testing. Each entry can be a string or an object.",
@@ -1292,6 +1304,9 @@
12921304
},
12931305
{
12941306
"$ref": "#/definitions/FileSystemSourceSchema"
1307+
},
1308+
{
1309+
"$ref": "#/definitions/WebSourceSchema"
12951310
}
12961311
]
12971312
},
@@ -1386,6 +1401,26 @@
13861401
}
13871402
}
13881403
},
1404+
"WebSourceSchema": {
1405+
"type": "object",
1406+
"additionalProperties": false,
1407+
"required": ["web"],
1408+
"properties": {
1409+
"web": {
1410+
"$ref": "#/definitions/WebSourceOptions"
1411+
}
1412+
}
1413+
},
1414+
"WebSourceOptions": {
1415+
"type": "object",
1416+
"additionalProperties": false,
1417+
"required": ["url"],
1418+
"properties": {
1419+
"url": {
1420+
"$ref": "#/definitions/SubstitutableString"
1421+
}
1422+
}
1423+
},
13891424
"RunOptions": {
13901425
"type": "object",
13911426
"additionalProperties": false,
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"contracts": [
3+
{
4+
"provides": ["api/order.yaml"],
5+
"web": {
6+
"url": "https://contracts.example.com"
7+
}
8+
}
9+
],
10+
"version": 2
11+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
{
2+
"components": {
3+
"services": {
4+
"orderApiService": {
5+
"definitions": [
6+
{
7+
"definition": {
8+
"source": {
9+
"$ref": "#/components/sources/remoteSpecs"
10+
},
11+
"specs": ["openapi/order-api.yaml"]
12+
}
13+
}
14+
]
15+
}
16+
},
17+
"sources": {
18+
"remoteSpecs": {
19+
"web": {
20+
"url": "https://contracts.example.com"
21+
}
22+
}
23+
}
24+
},
25+
"systemUnderTest": {
26+
"service": {
27+
"$ref": "#/components/services/orderApiService",
28+
"runOptions": {
29+
"openapi": {
30+
"baseUrl": "http://localhost:8080",
31+
"type": "test"
32+
}
33+
}
34+
}
35+
},
36+
"version": 3
37+
}

0 commit comments

Comments
 (0)