mirror of
https://github.com/simple-icons/simple-icons.git
synced 2024-12-16 01:10:30 +02:00
Add aliases to the JSON schema (#5369)
This commit is contained in:
parent
eb37e32112
commit
979836137d
@ -2,24 +2,20 @@
|
||||
"title": "Simple Icons",
|
||||
"definitions": {
|
||||
"brand": {
|
||||
"$id": "#brand",
|
||||
"description": "A single brand",
|
||||
"type": "object",
|
||||
"required": ["title", "hex", "source"],
|
||||
"properties": {
|
||||
"title": {
|
||||
"description": "The name of the brand",
|
||||
"type": "string"
|
||||
"$ref": "#/definitions/title"
|
||||
},
|
||||
"slug": {
|
||||
"description": "The brand name slug (used as filename in icons/)",
|
||||
"type": "string",
|
||||
"pattern": "^[a-z0-9\\-]+(_[a-z0-9\\-]+)?$",
|
||||
"required": false
|
||||
"$ref": "#/definitions/slug"
|
||||
},
|
||||
"hex": {
|
||||
"description": "The brand color as a 6-character value (without #)",
|
||||
"type": "string",
|
||||
"pattern": "^[0-9A-F]{6}$"
|
||||
"description": "The brand color",
|
||||
"$ref": "#/definitions/hex"
|
||||
},
|
||||
"source": {
|
||||
"description": "The website from which the icon was sourced",
|
||||
@ -29,6 +25,33 @@
|
||||
"description": "The brand guidelines",
|
||||
"$ref": "#/definitions/url"
|
||||
},
|
||||
"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
|
||||
},
|
||||
"license": {
|
||||
"description": "The license for the icon",
|
||||
"oneOf": [
|
||||
@ -145,11 +168,67 @@
|
||||
"additionalProperties": false
|
||||
}
|
||||
]
|
||||
|
||||
}
|
||||
},
|
||||
"additionalProperties": false
|
||||
},
|
||||
"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"
|
||||
},
|
||||
"url": {
|
||||
"$id": "#url",
|
||||
"type": "string",
|
||||
|
@ -287,6 +287,67 @@ If the SVG is sourced from:
|
||||
|
||||
In general, make sure the URL does not contain any tracking identifiers.
|
||||
|
||||
#### Aliases
|
||||
|
||||
Lastly, we aim to provide aliases of three types for various reasons. Each type of alias and its purpose can be found below. If you're unsure, you can mention an alias you're considering in your Pull Request so it can be discussed.
|
||||
|
||||
##### Also Known As
|
||||
|
||||
We collect "also known as" names to make it easier to find brands that are known by different names or by their abbreviation/full name. This does not include localized names, which are recorded separately. To add an "also known as" name you add the following to the icon data:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "the original title",
|
||||
"aliases": {
|
||||
"aka": [
|
||||
"tot",
|
||||
"thetitle"
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where the string is **different** from the original title as well as all other strings in the list.
|
||||
|
||||
##### Duplicates
|
||||
|
||||
We collect the names of duplicates, brands that use the same icon but have a different name, to prevent duplicating an SVG while at the same time making the SVG available under the name of the duplicate. To add a duplicate you add the following to the icon data:
|
||||
|
||||
```json5
|
||||
{
|
||||
"title": "the original title",
|
||||
"hex": "123456",
|
||||
"aliases": {
|
||||
"dup": [
|
||||
{
|
||||
"title": "the duplicate's title",
|
||||
"hex": "654321", // Only if different from original's color
|
||||
"guidelines": "..." // Only if different from original's guidelines
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where the nested `title` is the name of the duplicate brand. The other fields, `hex` and `guidelines`, are only provided if they differ from the original.
|
||||
|
||||
##### Localization
|
||||
|
||||
We collect localized names to make it possible to find the brand by it's local name, as well as to provide SVGs with localized titles. To add a localized name you add the following to the icon data:
|
||||
|
||||
```json
|
||||
{
|
||||
"title": "the original title",
|
||||
"aliases": {
|
||||
"loc": [
|
||||
{ "locale": "en-US", "title": "A different title" }
|
||||
]
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
Where the `locale` is an [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) and `title` is a **different** title from the original title.
|
||||
|
||||
### 8. Create a Pull Request
|
||||
|
||||
Once you've completed the previous steps, create a pull request to merge your edits into the *develop* branch. You can run `npm run lint` to check if there are any issues you still need to address.
|
||||
|
Loading…
Reference in New Issue
Block a user