sourcegraph/schema/phabricator.schema.json
Quinn Slack 82776aed75
do not show errors for trailing commas in web JSON editors (#4100)
fix #4008

All JSON documents we use (for settings, site config, external services, and extension manifests) support trailing commas on the frontend and backend. However, an upgrade to monaco-editor unexpectedly caused the Monaco JSON editors in our UI to show red squiggly errors for trailing commas.

The (undocumented) way to do this is to add `allowComments` to the root of the JSON Schema. It is not sufficient to set `allowComments: true` in a `monaco.languages.json.jsonDefaults.setDiagnosticsOptions` call. I found this secret fix by finding https://github.com/microsoft/vscode/issues/19992#issuecomment-347124969 and then inferring what changes that might entail, to discover `allowComments` in the JSON Schema is responsible for ignoring trailing comma errors.
2019-05-16 23:29:12 -07:00

43 lines
1.3 KiB
JSON

{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "phabricator.schema.json#",
"title": "PhabricatorConnection",
"description": "Configuration for a connection to Phabricator.",
"allowComments": true,
"type": "object",
"additionalProperties": false,
"anyOf": [{ "required": ["token"] }, { "required": ["repos"] }],
"properties": {
"url": {
"description": "URL of a Phabricator instance, such as https://phabricator.example.com",
"type": "string",
"examples": ["https://phabricator.example.com"]
},
"token": {
"description": "API token for the Phabricator instance.",
"type": "string",
"minLength": 1
},
"repos": {
"description": "The list of repositories available on Phabricator.",
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"additionalProperties": false,
"required": ["path", "callsign"],
"properties": {
"path": {
"description": "Display path for the url e.g. gitolite/my/repo",
"type": "string"
},
"callsign": {
"description": "The unique Phabricator identifier for the repository, like 'MUX'.",
"type": "string"
}
}
}
}
}
}