Skip to content

Commit 85f00ea

Browse files
authored
Define JSON Schema for user agent payload (#3378)
- Created a JSON Schema that defines the user agent JSON payload format.
1 parent 072f318 commit 85f00ea

File tree

2 files changed

+95
-1
lines changed

2 files changed

+95
-1
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ insert_final_newline = true
1111
indent_style = space
1212
indent_size = 4
1313

14-
[project.json]
14+
[*.{json,jsonc}]
1515
indent_size = 2
1616

1717
# C# files

spec/user-agent-v1.jsonc

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
{
2+
// This is the JSON Schema that defines the format of the TDS USERAGENT
3+
// Feature Extension payload (version 1) sent to the server during login.
4+
//
5+
// Feature Extension Name: USERAGENT
6+
// Feature Extension Version: 1
7+
// Schema Version: 1
8+
//
9+
// The design document for version 1 is here:
10+
//
11+
// https://microsoft.sharepoint-df.com/:w:/t/sqldevx/ERIWTt0zlCxLroNHyaPlKYwBI_LNSff6iy_wXZ8xX6nctQ?e=iP8q75
12+
13+
"$schema": "https://json-schema.org/draft/2020-12/schema",
14+
"$id": "urn:microsoft:mssql:user-agent:v1",
15+
"title": "Driver User Agent V1",
16+
"description": "The user agent payload sent by the driver during login.",
17+
18+
"type": "object",
19+
"properties":
20+
{
21+
"driver":
22+
{
23+
"enum": ["MS-JDBC", "MS-MDS", "MS-ODBC", "MS-OLEDB", "MS-PHP", "MS-PYTHON"],
24+
"description": "The type of driver."
25+
},
26+
"version":
27+
{
28+
"type": "string",
29+
"description": "The version of the driver, as a semantic version.",
30+
// See:
31+
//
32+
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
33+
//
34+
"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-]+)*))?$"
35+
},
36+
"os":
37+
{
38+
"type": "object",
39+
"description": "Information about the operating system.",
40+
"properties":
41+
{
42+
"type":
43+
{
44+
"enum": ["Windows", "Linux", "macOS", "FreeBSD", "Android", "Unknown"],
45+
"description": "The type of operating system."
46+
},
47+
"details":
48+
{
49+
"type": "string",
50+
"description": "Extended details of the operating system."
51+
}
52+
},
53+
"additionalProperties": false,
54+
"required": ["type", "details"]
55+
},
56+
"arch":
57+
{
58+
"type": "string",
59+
"description": "The architecture of the driver process."
60+
},
61+
"runtime":
62+
{
63+
"type": "string",
64+
"description": "The runtime environment of the driver."
65+
}
66+
},
67+
"additionalProperties": false,
68+
"required": ["driver", "version", "os", "arch", "runtime"],
69+
"examples":
70+
[
71+
{
72+
"driver": "MS-MDS",
73+
"version": "6.0.2",
74+
"os":
75+
{
76+
"type": "Linux",
77+
"details": "Debian GNU Linux 12.2 Bookworm"
78+
},
79+
"arch": "amd64",
80+
"runtime": ".NET 9.0.3"
81+
},
82+
{
83+
"driver": "MS-JDBC",
84+
"version": "11.2.0",
85+
"os":
86+
{
87+
"type": "Windows",
88+
"details": "Windows 10 Pro 22H2"
89+
},
90+
"arch": "x64",
91+
"runtime": "Java 17.0.8+7-LTS"
92+
}
93+
]
94+
}

0 commit comments

Comments
 (0)