simple-icons/.jsonschema.json

248 lines
7.4 KiB
JSON
Raw Normal View History

Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
{
"title": "Simple Icons",
"definitions": {
"brand": {
2021-05-06 13:50:44 +00:00
"$id": "#brand",
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
"description": "A single brand",
"type": "object",
"required": ["title", "hex", "source"],
"properties": {
"title": {
2021-05-06 13:50:44 +00:00
"$ref": "#/definitions/title"
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
},
"slug": {
2021-05-06 13:50:44 +00:00
"$ref": "#/definitions/slug"
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
},
"hex": {
2021-05-06 13:50:44 +00:00
"description": "The brand color",
"$ref": "#/definitions/hex"
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
},
"source": {
"description": "The website from which the icon was sourced",
"$ref": "#/definitions/url"
},
"guidelines": {
"description": "The brand guidelines",
"$ref": "#/definitions/url"
},
2021-05-06 13:50:44 +00:00
"aliases": {
"description": "The aliases for the brand",
"type": "object",
"properties": {
"aka": {
"description": "The brand is also known as (e.g. full length name or abbreviation)",
"type": "array",
"items": { "type": "string" }
},
"dup": {
"description": "Different brands that use the exact same icon",
"type": "array",
"items": { "$ref": "#/definitions/duplicate" }
},
"loc": {
"description": "Localized names of the brand",
"$ref": "#/definitions/locale"
},
"old": {
"description": "Old names, for backwards compatibility",
"type": "array",
"items": { "type": "string" }
}
},
"minProperties": 1,
"additionalProperties": false
},
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
"license": {
"description": "The license for the icon",
"oneOf": [
{
"type": "object",
"required": ["type", "url"],
"properties": {
"type": {
"description": "The license name or 'custom'",
"type": "string",
"enum": ["custom"]
},
"url": {
"description": "The URL to the license text by the brand",
"$ref": "#/definitions/url"
}
},
"additionalProperties": false
},
{
"type": "object",
"required": ["type"],
"properties": {
"type": {
"description": "An SPDX License Identifier",
"type": "string",
"enum": [
"0BSD",
"AAL",
"AFL-1.1",
"AFL-1.2",
"AFL-2.0",
"AFL-3.0",
"Afmparse",
"AGPL-1.0-only",
"AGPL-1.0-or-later",
"AGPL-3.0-only",
"AGPL-3.0-or-later",
"Aladdin",
"AML",
"AMPAS",
"Apache-1.0",
"Apache-1.1",
"Apache-2.0",
"APL-1.0",
"Artistic-1.0",
"Artistic-1.0-cl8",
"Artistic-1.0-Perl",
"Artistic-2.0",
"CC-BY-1.0",
"CC-BY-2.0",
"CC-BY-2.5",
"CC-BY-3.0",
"CC-BY-4.0",
2021-03-15 17:21:43 +00:00
"CC-BY-NC-1.0",
"CC-BY-NC-2.0",
"CC-BY-NC-2.5",
"CC-BY-NC-3.0",
"CC-BY-NC-4.0",
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
"CC-BY-NC-ND-1.0",
"CC-BY-NC-ND-2.0",
"CC-BY-NC-ND-2.5",
"CC-BY-NC-ND-3.0",
"CC-BY-NC-ND-4.0",
"CC-BY-NC-SA-1.0",
"CC-BY-NC-SA-2.0",
"CC-BY-NC-SA-2.5",
"CC-BY-NC-SA-3.0",
"CC-BY-NC-SA-4.0",
"CC-BY-ND-1.0",
"CC-BY-ND-2.0",
"CC-BY-ND-2.5",
"CC-BY-ND-3.0",
"CC-BY-ND-4.0",
"CC-BY-SA-1.0",
"CC-BY-SA-2.0",
"CC-BY-SA-2.5",
"CC-BY-SA-3.0",
"CC-BY-SA-4.0",
"CC-PDDC",
"CC0-1.0",
"CDDL-1.0",
"CDDL-1.1",
"ClArtistic",
"copyleft-next-0.3.0",
"copyleft-next-0.3.1",
"CPAL-1.0",
"CPL-1.0",
"CPOL-1.02",
"EUPL-1.0",
"EUPL-1.1",
"EUPL-1.2",
"GPL-1.0-only",
"GPL-1.0-or-later",
"GPL-2.0-only",
"GPL-2.0-or-later",
"GPL-3.0-only",
"GPL-3.0-or-later",
"LAL-1.2",
"LAL-1.3",
"MIT",
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
"NLPL",
"OPL-1.0",
"Unlicense",
"UPL-1.0",
"WTFPL"
]
},
"url": {
"description": "The URL to the license text by the brand",
"$ref": "#/definitions/url"
}
},
"additionalProperties": false
}
]
}
},
"additionalProperties": false
},
2021-05-06 13:50:44 +00:00
"duplicate": {
"$id": "#duplicate",
"description": "A \"dup\" brand",
"type": "object",
"required": ["title"],
"properties": {
"title": {
"$ref": "#/definitions/title"
},
"slug": {
"$ref": "#/definitions/slug"
},
"hex": {
"description": "The brand color, if different from the original",
"$ref": "#/definitions/hex"
},
"source": {
"description": "The website from which the duplicate's hex was sourced, if different from the original",
"$ref": "#/definitions/url"
},
"guidelines": {
"description": "The brand guidelines, if different from the original",
"$ref": "#/definitions/url"
}
},
"additionalProperties": false
},
"hex": {
"$id": "#hex",
"description": "A 6-character hexadecimal color value (without #)",
"type": "string",
"pattern": "^[0-9A-F]{6}$"
},
"locale": {
"$id": "#locale",
"description": "A localized brand name",
"type": "object",
"patternProperties": {
"^[a-z]{2}-[A-Z]{2}$": {
"type": "string",
"description": "The local name of the brand"
}
},
"minProperties": 1,
"additionalProperties": false
},
"slug": {
"$id": "#slug",
"description": "The brand name slug (used as filename in icons/)",
"type": "string",
"pattern": "^[a-z0-9\\-]+(_[a-z0-9\\-]+)?$"
},
"title": {
"$id": "#title",
"description": "The name of the brand",
"type": "string"
},
Add icon license to JSON linting (and change JSON linting dependency) (#4945) * Add "license" object to the data file JSON schema * Add license to GNU and GNU social As an example, based on the discussion in: https://github.com/simple-icons/simple-icons/issues/1167 * Use `"additionalProperties": false` in JSON schema ... to detect properties in the data file that shouldn't be there. For more info, see: https://json-schema.org/understanding-json-schema/reference/object.html * Update JSON scheme descriptions * Switch from jsonlint2 to jsonschema This gives is better support for advanced features of JSON schema. A couple of clarifications: - There does exist a jsonschema-cli package, but it is rather limited and crucially doens't exit with a non-zero exit code if there is an error. (it is also pretty old and not maintained), hence the custom script. - I renamed .jsonlintschema 1) for clarity (lint is no longer accurate) and 2) the .json extension allows easy imorting in the script and 3) it adds syntax highlighting. - The script outputs the number of errors in the end because the output gets pretty big pretty quickly, this way you can see it easily from your CLI. - We could customize how the errors are logged, but I feel that is beyond this PR. * Two minor changes * Use `oneOf` to require URL for custom licenses The updated configuration allows the `"license"` field to be either 1) a SPDX license, optional with a URL 2) a "custom" license with a required URL Read more about the "oneOf" feature of jsonschema at: https://json-schema.org/understanding-json-schema/reference/combining.html#oneof * Include license field in Contributing Guidelines
2021-02-19 14:19:22 +00:00
"url": {
"$id": "#url",
"type": "string",
"pattern": "^https?://[^\\s]+$"
}
},
"type": "object",
"properties": {
"icons": {
"description": "A list of brands",
"type": "array",
"items": { "$ref": "#/definitions/brand" }
}
}
}