Skip to content

Define JSON Schema for user agent payload #3378

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ insert_final_newline = true
indent_style = space
indent_size = 4

[project.json]
[*.{json,jsonc}]
indent_size = 2

# C# files
Expand Down
94 changes: 94 additions & 0 deletions spec/user-agent-v1.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
{
// This is the JSON Schema that defines the format of the TDS USERAGENT
// Feature Extension payload (version 1) sent to the server during login.
//
// Feature Extension Name: USERAGENT
// Feature Extension Version: 1
// Schema Version: 1
//
// The design document for version 1 is here:
//
// https://microsoft.sharepoint-df.com/:w:/t/sqldevx/ERIWTt0zlCxLroNHyaPlKYwBI_LNSff6iy_wXZ8xX6nctQ?e=iP8q75

"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "urn:microsoft:mssql:user-agent:v1",
"title": "Driver User Agent V1",
"description": "The user agent payload sent by the driver during login.",

"type": "object",
"properties":
{
"driver":
{
"enum": ["MS-JDBC", "MS-MDS", "MS-ODBC", "MS-OLEDB", "MS-PHP", "MS-PYTHON"],
"description": "The type of driver."
},
"version":
{
"type": "string",
"description": "The version of the driver, as a semantic version.",
// See:
//
// https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string
//
"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-]+)*))?$"
},
"os":
{
"type": "object",
"description": "Information about the operating system.",
"properties":
{
"type":
{
"enum": ["Windows", "Linux", "macOS", "FreeBSD", "Android", "Unknown"],
"description": "The type of operating system."
},
"details":
{
"type": "string",
"description": "Extended details of the operating system."
}
},
"additionalProperties": false,
"required": ["type", "details"]
},
"arch":
{
"type": "string",
"description": "The architecture of the driver process."
},
"runtime":
{
"type": "string",
"description": "The runtime environment of the driver."
}
},
"additionalProperties": false,
"required": ["driver", "version", "os", "arch", "runtime"],
"examples":
[
{
"driver": "MS-MDS",
"version": "6.0.2",
"os":
{
"type": "Linux",
"details": "Debian GNU Linux 12.2 Bookworm"
},
"arch": "amd64",
"runtime": ".NET 9.0.3"
},
{
"driver": "MS-JDBC",
"version": "11.2.0",
"os":
{
"type": "Windows",
"details": "Windows 10 Pro 22H2"
},
"arch": "x64",
"runtime": "Java 17.0.8+7-LTS"
}
]
}
Loading