Skip to content

Commit a03e77a

Browse files
romanrostislavovichxferra
authored andcommitted
feat: add core schemas
add core schemas: - `linterhub.json` - `deps.json` - `package.json` - `schemaver.json` - `collecton.json` all schemas used standart [`draft-06`](http://json-schema.org/specification-links.html#draft-6) Closes #4
1 parent 06f0555 commit a03e77a

File tree

7 files changed

+318
-0
lines changed

7 files changed

+318
-0
lines changed

ext/github/linguist

Submodule linguist added at b41875d

ext/spdx/license-list-data

Submodule license-list-data added at 7397fd1

src/schema/collection.json

Lines changed: 110 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,110 @@
1+
{
2+
"$schema": "https://schema.linterhub.com/schemaver.json",
3+
"$version": "1.0.0",
4+
"$id": "https://schema.linterhub.com/collection.json",
5+
"title": "Collections",
6+
"description": "The schema with references to external data sets",
7+
"type": "object",
8+
"definitions": {
9+
"language": {
10+
"title": "Language",
11+
"description": "The set of programming languages",
12+
"type": "string",
13+
"oneOf": [
14+
{
15+
"enum": [
16+
"1C Enterprise"
17+
],
18+
"extensions": [
19+
".bsl",
20+
".os"
21+
]
22+
},
23+
{
24+
"enum": [
25+
"ASP"
26+
],
27+
"extensions": [
28+
".asp",
29+
".asax",
30+
".ascx",
31+
".ashx",
32+
".asmx",
33+
".aspx",
34+
".axd"
35+
]
36+
}
37+
]
38+
},
39+
"license": {
40+
"$schema": "http://json-schema.org/draft-06/schema#",
41+
"title": "License",
42+
"description": "The set of software licenses names",
43+
"type": "string",
44+
"oneOf": [
45+
{
46+
"$schema": "http://json-schema.org/draft-06/schema#",
47+
"title": "Collection: software license",
48+
"description": "The set of special software licenses",
49+
"type": "string",
50+
"enum": [
51+
"Custom",
52+
"Unknown"
53+
],
54+
"additionalItems": false
55+
},
56+
{
57+
"$schema": "http://json-schema.org/draft-06/schema#",
58+
"title": "Collection: software license",
59+
"description": "The set of special software licenses",
60+
"type": "string",
61+
"enum": [
62+
"0BSD",
63+
"AAL",
64+
"ADSL",
65+
"MIT"
66+
],
67+
"additionalItems": false
68+
}
69+
]
70+
},
71+
"manager": {
72+
"$schema": "http://json-schema.org/draft-06/schema#",
73+
"title": "Collection: Package Manager",
74+
"description": "The set of names of package managers",
75+
"type": "string",
76+
"oneOf": [
77+
{
78+
"$schema": "http://json-schema.org/draft-06/schema#",
79+
"title": "Collection: Package Manager",
80+
"description": "The set of language package managers",
81+
"type": "string",
82+
"enum": [
83+
"bower",
84+
"composer",
85+
"npm",
86+
"pip",
87+
"yarn",
88+
"gem"
89+
],
90+
"additionalItems": false
91+
},
92+
{
93+
"$schema": "http://json-schema.org/draft-06/schema#",
94+
"title": "Collection: Package Manager",
95+
"description": "The set of system package managers",
96+
"type": "string",
97+
"enum": [
98+
"os",
99+
"url",
100+
"platform",
101+
"pacman",
102+
"chocolatey"
103+
],
104+
"additionalItems": false
105+
}
106+
],
107+
"additionalItems": false
108+
}
109+
}
110+
}

src/schema/deps.json

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
{
2+
"$schema": "https://schema.linterhub.com/schemaver.json",
3+
"$version": "1.0.0",
4+
"$id": "https://schema.linterhub.com/deps.json",
5+
"title": "Package dependencies",
6+
"description": "The schema of dependencies that extends package",
7+
"type": "object",
8+
"properties": {
9+
"package": {
10+
"title": "Package",
11+
"description": "The package unique identifier in URI form which points to current version of package file",
12+
"type": "string",
13+
"format": "uri"
14+
},
15+
"dependencies": {
16+
"title": "Dependencies",
17+
"description": "The array of linter dependencies, where each dependency is an array of required packages",
18+
"type": "array",
19+
"items": {
20+
"$ref": "#/definitions/dependency"
21+
},
22+
"minItems": 1,
23+
"uniqueItems": true
24+
}
25+
},
26+
"required": [
27+
"package",
28+
"dependencies"
29+
],
30+
"definitions": {
31+
"dependency": {
32+
"title": "Dependency",
33+
"description": "The array of required packages",
34+
"type": "array",
35+
"items": {
36+
"$ref": "#/definitions/package"
37+
},
38+
"minLength": 1,
39+
"uniqueItems": true
40+
},
41+
"package": {
42+
"title": "Package",
43+
"description": "The definition of required package, later it should be converted to package-id reference",
44+
"type": "object",
45+
"properties": {
46+
"manager": {
47+
"title": "Package manager",
48+
"description": "The package manager name",
49+
"type": "string",
50+
"$ref": "./collection.json#/definitions/manager"
51+
},
52+
"package": {
53+
"title": "Package",
54+
"description": "The package name in a format accepted by package manager",
55+
"type": "string"
56+
},
57+
"version": {
58+
"title": "Version",
59+
"description": "The package version in a format accepted by package manager, if not specifdied the latest version is assumed",
60+
"type": "string"
61+
},
62+
"target": {
63+
"type": "boolean",
64+
"title": "Target",
65+
"description": "The flag indicating whether the package is the target itself",
66+
"default": false
67+
}
68+
},
69+
"required": [
70+
"manager",
71+
"package"
72+
],
73+
"additionalProperties": true
74+
}
75+
}
76+
}

src/schema/linter.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"$schema": "https://schema.linterhub.com/schemaver.json",
3+
"$version": "1.0.0",
4+
"$id": "https://schema.linterhub.com/linter.json",
5+
"title": "Linter meta-information",
6+
"description": "The schema of linter meta-information that extends package",
7+
"type": "object",
8+
"properties": {
9+
"package": {
10+
"title": "Package",
11+
"description": "The package unique identifier in URI form which points to current version of package file",
12+
"type": "string",
13+
"format": "uri"
14+
},
15+
"languages": {
16+
"type": "array",
17+
"description": "The list of supported languages",
18+
"items": {
19+
"$ref": "./collection.json#/definitions/language"
20+
}
21+
},
22+
"extensions": {
23+
"title": "Extensions",
24+
"description": "The list of supported extensions, by default corresponding extensions for linter languages are used",
25+
"type": "array",
26+
"default": [],
27+
"items": {
28+
"$ref": "#/definitions/extension"
29+
}
30+
},
31+
"configs": {
32+
"title": "Configuration files",
33+
"description": "List of file names or masks which could be treated as linter configuration file",
34+
"type": "array",
35+
"default": [],
36+
"items": {
37+
"type": "string"
38+
}
39+
}
40+
},
41+
"required": [
42+
"package"
43+
],
44+
"definitions": {
45+
"extension": {
46+
"title": "Extension",
47+
"description": "The filename extension",
48+
"type": "string",
49+
"pattern": "^\\..*"
50+
}
51+
}
52+
}

src/schema/package.json

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
{
2+
"$schema": "https://schema.linterhub.com/schemaver.json",
3+
"$version": "1.0.0",
4+
"$id": "https://schema.linterhub.com/package.json",
5+
"title": "Package meta-information",
6+
"description": "The schema of package meta information",
7+
"type": "object",
8+
"properties": {
9+
"package": {
10+
"title": "Package",
11+
"description": "The package unique identifier in URI form which points to current version of package file",
12+
"type": "string",
13+
"format": "uri"
14+
},
15+
"name": {
16+
"title": "Name",
17+
"description": "The original name of the package",
18+
"type": "string"
19+
},
20+
"version": {
21+
"title": "Version",
22+
"description": "The package version in a format it was originally specified",
23+
"type": "string"
24+
},
25+
"description": {
26+
"title": "Description",
27+
"description": "The textual description of the package",
28+
"type": "string"
29+
},
30+
"url": {
31+
"title": "URL",
32+
"description": "The package homepage (website, online documentation or repository)",
33+
"type": "string",
34+
"format": "uri"
35+
},
36+
"license": {
37+
"title": "License",
38+
"description": "The package license",
39+
"type": "string",
40+
"$ref": "./collection.json#/definitions/license"
41+
},
42+
"license-text": {
43+
"type": "string",
44+
"description": "The package license text"
45+
}
46+
},
47+
"required": [
48+
"package",
49+
"name",
50+
"license"
51+
]
52+
}

src/schema/schemaver.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"$schema": "http://json-schema.org/draft-06/schema#",
3+
"$version": "1.0.0",
4+
"$id": "https://schema.linterhub.com/schemaver.json",
5+
"title": "Versioned Schema",
6+
"description": "The meta-schema of versioned JSON schema",
7+
"type": "object",
8+
"allOf": [
9+
{
10+
"$ref": "http://json-schema.org/draft-06/schema#"
11+
},
12+
{
13+
"properties": {
14+
"$version": {
15+
"title": "Version",
16+
"description": "The version of the object",
17+
"type": "string",
18+
"pattern": "^[0-9]+.[0-9]+.[0-9]+$"
19+
}
20+
},
21+
"required": [
22+
"$version"
23+
]
24+
}
25+
]
26+
}

0 commit comments

Comments
 (0)