1
+ local pat_version = [[ ([0-9]|[1-9][0-9]*)(\.([0-9]|[1-9][0-9]*))*]]
2
+ local pat_range = [[ ((==|~=|<|>|<=|>=|~>)\s*)?]] .. pat_version
3
+
4
+ local PAT_VERSION = " ^" .. pat_version .. " $"
5
+ local PAT_RANGE = " ^" .. pat_range .. [[ (\s*,\s*]] .. pat_range .. [[ )*$]]
6
+ local PAT_URL = [[ ^(file|git(\+(https?|ssh))?|https?)://]]
7
+
1
8
return {
2
9
title = " PlugSpec" ,
3
10
description = " A PlugSpec for a Neovim plugin" ,
@@ -16,13 +23,13 @@ return {
16
23
implementation should check for a `version` prefixed with `v` in the
17
24
git repository, as this is a common convention.
18
25
]] ,
19
- -- TODO: specify format
20
26
type = " string" ,
27
+ pattern = PAT_VERSION ,
21
28
},
22
29
packspec = {
23
30
description = " The current specification version. (0.1.0) at this time." ,
24
- -- TODO: specify format
25
- type = " string "
31
+ type = " string " ,
32
+ pattern = PAT_VERSION ,
26
33
},
27
34
source = {
28
35
description = [[
@@ -43,6 +50,7 @@ return {
43
50
* `https://` - for HTTPS URLs
44
51
]] ,
45
52
type = " string" ,
53
+ pattern = PAT_URL ,
46
54
},
47
55
description = {
48
56
description = " Description of the package" ,
@@ -108,14 +116,15 @@ return {
108
116
corresponding to that upper bound is the latest commit that
109
117
is valid
110
118
]] ,
111
- -- TODO: specify format
112
- type = ' string '
119
+ type = ' string ' ,
120
+ pattern = PAT_RANGE ,
113
121
},
114
122
source = {
115
123
description = [[
116
124
Source of the dependency. See previous `source` description.
117
125
]] ,
118
- type = ' string'
126
+ type = ' string' ,
127
+ pattern = PAT_URL ,
119
128
},
120
129
releases_only = {
121
130
description = [[
@@ -143,7 +152,8 @@ return {
143
152
properties = {
144
153
version = {
145
154
description = " Same as `dependencies`" ,
146
- type = ' string'
155
+ type = ' string' ,
156
+ pattern = PAT_RANGE ,
147
157
}
148
158
}
149
159
}
0 commit comments