Skip to content

Commit

Permalink
Add schema for dotnet-tools.json manifest file (#3517)
Browse files Browse the repository at this point in the history
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ChristopherHaws and pre-commit-ci[bot] authored Jan 16, 2024
1 parent 90ee585 commit b1d6ae0
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/api/json/catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -1596,6 +1596,12 @@
"fileMatch": ["dotnet-release-index.json"],
"url": "https://json.schemastore.org/dotnet-releases-index.json"
},
{
"name": "dotnet-tools.json",
"description": ".NET tools manifest file",
"fileMatch": ["dotnet-tools.json"],
"url": "https://json.schemastore.org/dotnet-tools.json"
},
{
"name": "dotnetcli.host.json",
"description": ".NET CLI template host files",
Expand Down
5 changes: 5 additions & 0 deletions src/schema-validation.json
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,11 @@
"unknownKeywords": ["examples"]
}
},
{
"dotnet-tools.json": {
"unknownKeywords": ["allowTrailingCommas"]
}
},
{
"drone.json": {
"unknownKeywords": [
Expand Down
51 changes: 51 additions & 0 deletions src/schemas/json/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "https://json.schemastore.org/dotnet-tools.json",
"allowTrailingCommas": false,
"type": "object",
"required": ["version", "isRoot", "tools"],
"additionalProperties": true,
"properties": {
"version": {
"type": "integer",
"title": ".NET Tools Manifest Version",
"description": "Specifies the version of the local tool manifest file format."
},
"isRoot": {
"type": "boolean",
"title": "Root/Top-Most Manifest File Indicator",
"description": "Indicates whether this is the root manifest file. If true, dotnet will not continue to search parent directories for additional dotnet-tools.json files."
},
"tools": {
"type": "object",
"title": "Local Tools",
"description": "Mappings of .NET CLI tools that are available locally for the project. Each entry specifies a tool accessible by its NuGet package ID.",
"patternProperties": {
"^.*$": {
"type": "object",
"title": "Tool Configuration",
"description": "Represents a single .NET CLI tool with its specific settings and commands.",
"required": ["version", "commands"],
"additionalProperties": true,
"properties": {
"version": {
"type": ["string", "null"],
"title": "Tool NuGet Version",
"description": "Specifies the version of the NuGet package of the tool. If null, the latest version will be used."
},
"commands": {
"type": ["array", "null"],
"title": "Available Tool Commands",
"description": "Lists all of the available commands provided by this tool. The way to invoke a command depends on the naming format of its executable. If the command is in the format `dotnet-<toolName>`, it should be invoked using 'dotnet <toolName>'. If the command is in the format '<toolName>', it can be directly invoked using just '<toolName>'. If null, no specific commands are specified.",
"items": {
"type": ["string", "null"],
"title": "Tool Command",
"description": "A command made available by this tool which can be invoked according to the naming convention of its executable. If the command is in the format `dotnet-<toolName>`, it should be invoked using 'dotnet <toolName>'. If the command is in the format '<toolName>', it can be directly invoked using just '<toolName>'. If null, no specific commands are specified."
}
}
}
}
}
}
}
}
10 changes: 10 additions & 0 deletions src/test/dotnet-tools/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"isRoot": true,
"tools": {
"dotnet-ef": {
"commands": ["dotnet-ef"],
"version": "8.0.1"
}
},
"version": 1
}

0 comments on commit b1d6ae0

Please sign in to comment.