diff --git a/schemas/json/font-collection.json b/schemas/json/font-collection.json index 922569b47d9408..41c4c6202fb899 100644 --- a/schemas/json/font-collection.json +++ b/schemas/json/font-collection.json @@ -2,6 +2,99 @@ "title": "JSON schema for WordPress Font Collections", "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", + "definitions": { + "fontFace": { + "description": "Font face theme.json settings, with added preview property.", + "type": "object", + "properties": { + "preview": { + "description": "URL to a preview image of the font.", + "type": "string" + }, + "fontFamily": { + "description": "CSS font-family value.", + "type": "string", + "default": "" + }, + "fontStyle": { + "description": "CSS font-style value.", + "type": "string", + "default": "normal" + }, + "fontWeight": { + "description": "List of available font weights, separated by a space.", + "default": "400", + "oneOf": [ + { + "type": "string" + }, + { + "type": "integer" + } + ] + }, + "fontDisplay": { + "description": "CSS font-display value.", + "type": "string", + "default": "fallback", + "enum": [ "auto", "block", "fallback", "swap", "optional" ] + }, + "src": { + "description": "Paths or URLs to the font files.", + "oneOf": [ + { + "type": "string" + }, + { + "type": "array", + "items": { + "type": "string" + } + } + ], + "default": [] + }, + "fontStretch": { + "description": "CSS font-stretch value.", + "type": "string" + }, + "ascentOverride": { + "description": "CSS ascent-override value.", + "type": "string" + }, + "descentOverride": { + "description": "CSS descent-override value.", + "type": "string" + }, + "fontVariant": { + "description": "CSS font-variant value.", + "type": "string" + }, + "fontFeatureSettings": { + "description": "CSS font-feature-settings value.", + "type": "string" + }, + "fontVariationSettings": { + "description": "CSS font-variation-settings value.", + "type": "string" + }, + "lineGapOverride": { + "description": "CSS line-gap-override value.", + "type": "string" + }, + "sizeAdjust": { + "description": "CSS size-adjust value.", + "type": "string" + }, + "unicodeRange": { + "description": "CSS unicode-range value.", + "type": "string" + } + }, + "required": [ "fontFamily", "src" ], + "additionalProperties": false + } + }, "properties": { "$schema": { "description": "JSON schema URI for font-collection.json.", @@ -21,12 +114,12 @@ }, "font_families": { "type": "array", - "description": "Array of font families ready to be installed", + "description": "Array of font families ready to be installed.", "items": { "type": "object", "properties": { "font_family_settings": { - "description": "Font family settings similar to theme.json but without fontFace key.", + "description": "Font family theme.json settings, with added preview property.", "type": "object", "properties": { "name": { @@ -40,41 +133,31 @@ "fontFamily": { "description": "CSS font-family value.", "type": "string" - } - }, - "additionalProperties": false - }, - "font_faces": { - "description": "Array of font-face declarations.", - "type": "array", - "items": { - "type": "object", - "properties": { - "preview": { - "type": "string", - "description": "URL to a preview image of the font face" - }, - "font_face_settings": { - "description": "Font face settings as in theme.json", + }, + "preview": { + "type": "string", + "description": "URL to a preview image of the font family." + }, + "fontFace": { + "description": "Array of font-face definitions.", + "type": "array", + "items": { "allOf": [ { - "$ref": "./theme.json#/definitions/fontFace" + "$ref": "#/definitions/fontFace" } ] } } - } + }, + "additionalProperties": false }, "categories": { "type": "array", - "description": "Array of category slugs", + "description": "Array of category slugs.", "items": { "type": "string" } - }, - "preview": { - "type": "string", - "description": "URL to a preview image of the font family" } }, "required": [ "font_family_settings" ], @@ -83,7 +166,7 @@ }, "categories": { "type": "array", - "description": "Array of category objects", + "description": "Array of category objects.", "items": { "type": "object", "properties": {