Skip to content

Commit 645ef04

Browse files
committed
add commit hash to dub.json schema
1 parent 495959d commit 645ef04

File tree

2 files changed

+26
-3
lines changed

2 files changed

+26
-3
lines changed

json-validation/dub.schema.json

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,13 +178,28 @@
178178
},
179179
"version": {
180180
"type": "string",
181-
"description": "The version specification as used for the simple form"
181+
"description": "The version specification as used for the simple form or the commit hash of the git repository specified in \"repository\""
182182
},
183183
"path": {
184184
"type": "string",
185185
"description": "Use a folder to source a package from"
186+
},
187+
"repository": {
188+
"type": "string",
189+
"description": "Path to a git repository with a leading `git+` prefix like `git+https://github.com/dlang-community/gitcompatibledubpackage.git`"
190+
}
191+
},
192+
"oneOf": [
193+
{
194+
"required": ["path"]
195+
},
196+
{
197+
"required": ["version"]
198+
},
199+
{
200+
"required": ["repository", "version"]
186201
}
187-
}
202+
]
188203
}
189204
]
190205
},

src/sdl/sdl-contributions.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ function pad3(n: number) {
3939
function completeDubVersion(info: SDLCompletionInfo): SDLCompletionResult {
4040
if (!info.currentSDLObject.values || info.currentSDLObject.values.length != 1)
4141
return [];
42+
if (info.currentSDLObject.attributes.repository)
43+
return []; // no autocompletion of version when repository is set
4244
var packageName = info.currentSDLObject.values[0].value;
4345
return new Promise((resolve) => {
4446
getPackageInfo(packageName).then(json => {
@@ -317,7 +319,7 @@ const buildSettings: CompletionTagMap = {
317319
},
318320
attributes: {
319321
version: {
320-
description: "The version specification as used for the simple form",
322+
description: "The version specification as used for the simple form or the commit hash of the git repository specified in \"repository\"",
321323
values: {
322324
type: "string",
323325
pattern: {
@@ -331,6 +333,12 @@ const buildSettings: CompletionTagMap = {
331333
type: "string"
332334
}
333335
},
336+
repository: {
337+
description: "Path to a git repository with a leading `git+` prefix like `git+https://github.com/dlang-community/gitcompatibledubpackage.git`",
338+
values: {
339+
type: "string"
340+
}
341+
},
334342
optional: {
335343
description: "Indicates an optional dependency",
336344
values: {

0 commit comments

Comments
 (0)