mirror of
https://github.com/cemu-project/vcpkg.git
synced 2024-11-26 20:50:36 +00:00
[vcpkg] Add a schema file for vcpkg.json (#12178)
* Add a schema file for vcpkg.json * [vcpkg.schema.json] fix $ref fields Per json schema, having any other field in a `{ "$ref": ""}` object is invalid. * [vcpkg.schema.json] change case to reflect usage * [vcpkg.schema.json] check reserved names for identifiers * [vcpkg.schema.json] add an $id field * [vcpkg.schema.json] Apply suggestions from code review Co-authored-by: nicole mazzuca <mazzucan@outlook.com> * [vcpkg.schema.json] Apply suggestions from code review Co-authored-by: nicole mazzuca <mazzucan@outlook.com>
This commit is contained in:
parent
8d50672e04
commit
f4b66c5e2b
206
scripts/vcpkg.schema.json
Normal file
206
scripts/vcpkg.schema.json
Normal file
@ -0,0 +1,206 @@
|
||||
{
|
||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"$id": "https://raw.githubusercontent.com/microsoft/vcpkg/master/scripts/vcpkg.schema.json",
|
||||
"title": "Vcpkg manifest",
|
||||
"description": "Vcpkg manifest file. See https://github.com/microsoft/vcpkg/blob/master/docs/specifications/manifests.md.",
|
||||
"definitions": {
|
||||
"identifier": {
|
||||
"description": "Identifiers used for feature names.",
|
||||
"allOf": [
|
||||
{
|
||||
"description": "Identifier are lowercase with digits and dashes.",
|
||||
"type": "string",
|
||||
"pattern": "[a-z0-9]+(-[a-z0-9]+)*"
|
||||
},
|
||||
{
|
||||
"not": {
|
||||
"description": "Identifiers must not be a Windows filesystem or vcpkg reserved name.",
|
||||
"type": "string",
|
||||
"pattern": "^prn|aux|nul|con|lpt[1-9]|com[1-9]|core|default$"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"package-name": {
|
||||
"description": "Name of a package.",
|
||||
"allOf": [
|
||||
{
|
||||
"description": "Package name must be a dot-separated list of valid identifiers",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9]+(-[a-z0-9]+)*(\\.[a-z0-9]+(-[a-z0-9]+)*)*$"
|
||||
},
|
||||
{
|
||||
"not": {
|
||||
"description": "Identifiers must not be a Windows filesystem or vcpkg reserved name.",
|
||||
"type": "string",
|
||||
"pattern": "(^|\\.)(prn|aux|nul|con|lpt[1-9]|com[1-9]|core|default)(\\.|$)"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"description-field": {
|
||||
"description": "A string or array of strings containing the description of a package or feature.",
|
||||
"oneOf": [
|
||||
{
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"dependency-object": {
|
||||
"description": "Expanded form of a dependency with explicit features and platform.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"$ref": "#/definitions/package-name"
|
||||
},
|
||||
"features": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/identifier"
|
||||
}
|
||||
},
|
||||
"default-features": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
},
|
||||
"platform": {
|
||||
"$ref": "#/definitions/platform-expression"
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
"^\\$": {}
|
||||
},
|
||||
"required": [
|
||||
"name"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"dependency": {
|
||||
"description": "A dependency fetchable by Vcpkg.",
|
||||
"oneOf": [
|
||||
{
|
||||
"$ref": "#/definitions/package-name"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/dependency-object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"platform-expression": {
|
||||
"description": "A specification of a set of platforms. See https://github.com/microsoft/vcpkg/blob/master/docs/specifications/manifests.md#definitions.",
|
||||
"type": "string"
|
||||
},
|
||||
"feature": {
|
||||
"description": "A package feature that can be activated by consumers.",
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"$ref": "#/definitions/identifier"
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/definitions/description-field"
|
||||
},
|
||||
"dependencies": {
|
||||
"description": "Dependencies used by this feature.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dependency"
|
||||
}
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
"^\\$": {}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"description"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"name": {
|
||||
"$ref": "#/definitions/package-name"
|
||||
},
|
||||
"version-string": {
|
||||
"description": "A string without semantic meaning, equivalent to `CONTROL`'s `Version` field.",
|
||||
"type": "string"
|
||||
},
|
||||
"port-version": {
|
||||
"description": "A non-negative integer. If this field doesn't exist, it's assumed to be `0`.",
|
||||
"type": "integer",
|
||||
"minimum": 0,
|
||||
"default": 0
|
||||
},
|
||||
"maintainers": {
|
||||
"description": "An array of strings which contain the authors of a package",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"description": {
|
||||
"$ref": "#/definitions/description-field"
|
||||
},
|
||||
"homepage": {
|
||||
"description": "A url which points to the homepage of a package.",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"documentation": {
|
||||
"description": "A url which points to the documentation of a package.",
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
},
|
||||
"license": {
|
||||
"description": "An SPDX license expression at version 3.9.",
|
||||
"type": "string"
|
||||
},
|
||||
"dependencies": {
|
||||
"description": "Dependencies that are always required.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dependency"
|
||||
}
|
||||
},
|
||||
"dev-dependencies": {
|
||||
"description": "Dependencies only required for developers (testing and the like).",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/dependency"
|
||||
}
|
||||
},
|
||||
"features": {
|
||||
"description": "An array of features supported by the package",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/feature"
|
||||
}
|
||||
},
|
||||
"default-features": {
|
||||
"description": "Features enabled by default with the package.",
|
||||
"type": "array",
|
||||
"items": {
|
||||
"$ref": "#/definitions/identifier"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"$ref": "#/definitions/platform-expression"
|
||||
}
|
||||
},
|
||||
"patternProperties": {
|
||||
"^\\$": {}
|
||||
},
|
||||
"required": [
|
||||
"name",
|
||||
"version-string"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
Loading…
Reference in New Issue
Block a user