Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,8 @@
],
"nohoist": [
"husky",
"run-node"
"run-node",
"**/ajv-cli"
]
},
"private": true,
Expand Down
341 changes: 341 additions & 0 deletions packages/netlify-cms-core/configSchema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,341 @@
{
"type": "object",
"properties": {
"backend": {
"type": "object",
"properties": {
"name": { "type": "string", "examples": ["test-repo"] },
"auth_scope": {
"type": "string",
"examples": ["repo", "public_repo"],
"enum": ["repo", "public_repo"]
},
"cms_label_prefix": { "type": "string", "minLength": 1 },
"open_authoring": { "type": "boolean", "examples": [true] }
},
"required": ["name"]
},
"local_backend": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"properties": {
"url": { "type": "string", "examples": ["http://localhost:8081/api/v1"] },
"allowed_hosts": { "type": "array", "items": { "type": "string" } }
},
"additionalProperties": false
}
]
},
"locale": { "type": "string", "examples": ["en", "fr", "de"] },
"i18n": {
"type": "object",
"properties": {
"structure": {
"type": "string",
"enum": ["multiple_folders", "multiple_files", "single_file"]
},
"locales": {
"type": "array",
"minItems": 2,
"items": {
"type": "string",
"minLength": 2,
"maxLength": 10,
"pattern": "^[a-zA-Z-_]+$"
},
"uniqueItems": true
},
"default_locale": {
"type": "string",
"minLength": 2,
"maxLength": 10,
"pattern": "^[a-zA-Z-_]+$"
}
},
"required": ["structure", "locales"]
},
"site_url": { "type": "string", "examples": ["https://example.com"] },
"display_url": { "type": "string", "examples": ["https://example.com"] },
"logo_url": { "type": "string", "examples": ["https://example.com/images/logo.svg"] },
"show_preview_links": { "type": "boolean" },
"media_folder": { "type": "string", "examples": ["assets/uploads"] },
"public_folder": { "type": "string", "examples": ["/uploads"] },
"media_folder_relative": { "type": "boolean" },
"media_library": {
"type": "object",
"properties": {
"name": { "type": "string", "examples": ["uploadcare"] },
"config": { "type": "object" }
},
"required": ["name"]
},
"publish_mode": {
"type": "string",
"enum": ["simple", "editorial_workflow"],
"examples": ["editorial_workflow"]
},
"slug": {
"type": "object",
"properties": {
"encoding": { "type": "string", "enum": ["unicode", "ascii"] },
"clean_accents": { "type": "boolean" }
}
},
"collections": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"label": { "type": "string" },
"label_singular": { "type": "string" },
"description": { "type": "string" },
"folder": { "type": "string" },
"files": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": { "type": "string" },
"label": { "type": "string" },
"label_singular": { "type": "string" },
"description": { "type": "string" },
"file": { "type": "string" },
"preview_path": { "type": "string" },
"preview_path_date_field": { "type": "string" },
"fields": {
"$id": "fields_478f58a3-0939-44d3-824b-42f1c0aa4f89",
"type": "array",
"minItems": 1,
"items": {
"$id": "field_478f58a3-0939-44d3-824b-42f1c0aa4f89",
"type": "object",
"properties": {
"name": { "type": "string" },
"label": { "type": "string" },
"widget": { "type": "string" },
"required": { "type": "boolean" },
"i18n": {
"oneOf": [
{ "type": "boolean" },
{ "type": "string", "enum": ["translate", "duplicate", "none"] }
]
},
"hint": { "type": "string" },
"pattern": {
"type": "array",
"minItems": 2,
"items": [
{ "oneOf": [{ "type": "string" }] },
{ "type": "string" }
]
},
"field": { "$ref": "field_478f58a3-0939-44d3-824b-42f1c0aa4f89" },
"fields": { "$ref": "fields_478f58a3-0939-44d3-824b-42f1c0aa4f89" },
"types": { "$ref": "fields_478f58a3-0939-44d3-824b-42f1c0aa4f89" }
},
"select": { "$data": "0/widget" },
"selectCases": {
"relation": {
"properties": {
"search_fields": { "type": "array", "items": { "type": "string" } },
"display_fields": { "type": "array", "items": { "type": "string" } }
}
}
},
"required": ["name"]
}
}
},
"required": ["name", "label", "file", "fields"]
}
},
"identifier_field": { "type": "string" },
"summary": { "type": "string" },
"slug": { "type": "string" },
"path": { "type": "string" },
"preview_path": { "type": "string" },
"preview_path_date_field": { "type": "string" },
"create": { "type": "boolean" },
"publish": { "type": "boolean" },
"hide": { "type": "boolean" },
"editor": { "type": "object", "properties": { "preview": { "type": "boolean" } } },
"format": {
"type": "string",
"enum": [
"yml",
"yaml",
"toml",
"json",
"frontmatter",
"json-frontmatter",
"toml-frontmatter",
"yaml-frontmatter"
]
},
"extension": { "type": "string" },
"frontmatter_delimiter": {
"type": ["string", "array"],
"minItems": 2,
"maxItems": 2,
"items": { "type": "string" }
},
"fields": {
"$id": "fields_135af09a-7035-4830-8ed7-260197843a0b",
"type": "array",
"minItems": 1,
"items": {
"$id": "field_135af09a-7035-4830-8ed7-260197843a0b",
"type": "object",
"properties": {
"name": { "type": "string" },
"label": { "type": "string" },
"widget": { "type": "string" },
"required": { "type": "boolean" },
"i18n": {
"oneOf": [
{ "type": "boolean" },
{ "type": "string", "enum": ["translate", "duplicate", "none"] }
]
},
"hint": { "type": "string" },
"pattern": {
"type": "array",
"minItems": 2,
"items": [
{ "oneOf": [{ "type": "string" }] },
{ "type": "string" }
]
},
"field": { "$ref": "field_135af09a-7035-4830-8ed7-260197843a0b" },
"fields": { "$ref": "fields_135af09a-7035-4830-8ed7-260197843a0b" },
"types": { "$ref": "fields_135af09a-7035-4830-8ed7-260197843a0b" }
},
"select": { "$data": "0/widget" },
"selectCases": {
"relation": {
"properties": {
"search_fields": { "type": "array", "items": { "type": "string" } },
"display_fields": { "type": "array", "items": { "type": "string" } }
}
}
},
"required": ["name"]
}
},
"sortable_fields": { "type": "array", "items": { "type": "string" } },
"sortableFields": { "type": "array", "items": { "type": "string" } },
"view_filters": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"label": { "type": "string" },
"field": { "type": "string" },
"pattern": { "oneOf": [{ "type": "boolean" }, { "type": "string" }] }
},
"additionalProperties": false,
"required": ["label", "field", "pattern"]
}
},
"view_groups": {
"type": "array",
"minItems": 1,
"items": {
"type": "object",
"properties": {
"label": { "type": "string" },
"field": { "type": "string" },
"pattern": { "type": "string" }
},
"additionalProperties": false,
"required": ["label", "field"]
}
},
"nested": {
"type": "object",
"properties": {
"depth": { "type": "number", "minimum": 1, "maximum": 1000 },
"summary": { "type": "string" }
},
"required": ["depth"]
},
"meta": {
"type": "object",
"properties": {
"path": {
"type": "object",
"properties": {
"label": { "type": "string" },
"widget": { "type": "string" },
"index_file": { "type": "string" }
},
"required": ["label", "widget", "index_file"]
}
},
"additionalProperties": false,
"minProperties": 1
},
"i18n": {
"oneOf": [
{ "type": "boolean" },
{
"type": "object",
"properties": {
"structure": {
"type": "string",
"enum": ["multiple_folders", "multiple_files", "single_file"]
},
"locales": {
"type": "array",
"minItems": 2,
"items": {
"type": "string",
"minLength": 2,
"maxLength": 10,
"pattern": "^[a-zA-Z-_]+$"
},
"uniqueItems": true
},
"default_locale": {
"type": "string",
"minLength": 2,
"maxLength": 10,
"pattern": "^[a-zA-Z-_]+$"
}
}
}
]
}
},
"required": ["name", "label"],
"oneOf": [{ "required": ["files"] }, { "required": ["folder", "fields"] }],
"not": { "required": ["sortable_fields", "sortableFields"] },
"if": { "required": ["extension"] },
"then": {
"if": {
"properties": {
"extension": { "enum": ["yml", "yaml", "toml", "json", "md", "markdown", "html"] }
}
},
"else": { "required": ["format"] }
},
"dependencies": {
"frontmatter_delimiter": {
"properties": {
"format": { "enum": ["yaml-frontmatter", "toml-frontmatter", "json-frontmatter"] }
},
"required": ["format"]
}
}
}
},
"editor": { "type": "object", "properties": { "preview": { "type": "boolean" } } }
},
"required": ["backend", "collections"],
"anyOf": [{ "required": ["media_folder"] }, { "required": ["media_library"] }]
}
6 changes: 4 additions & 2 deletions packages/netlify-cms-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
"develop": "yarn build:esm --watch",
"webpack": "node --max_old_space_size=4096 ../../node_modules/webpack/bin/webpack.js",
"build": "cross-env NODE_ENV=production run-s webpack",
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\""
"build:esm": "cross-env NODE_ENV=esm babel src --out-dir dist/esm --ignore \"**/__tests__\" --root-mode upward --extensions \".js,.jsx,.ts,.tsx\"",
"generate-validate": "ajv compile --strict=false --all-errors --data -s configSchema.json -o src/constants/validateSchema.js -c ajv-keywords -c ajv-errors"
},
"keywords": [
"netlify",
Expand All @@ -26,7 +27,7 @@
"license": "MIT",
"dependencies": {
"@iarna/toml": "2.2.5",
"ajv": "8.1.0",
"ajv": "^8.7.1",
"ajv-errors": "^3.0.0",
"ajv-keywords": "^5.0.0",
"copy-text-to-clipboard": "^3.0.0",
Expand Down Expand Up @@ -94,6 +95,7 @@
"@types/history": "^4.7.8",
"@types/redux-mock-store": "^1.0.2",
"@types/url-join": "^4.0.0",
"ajv-cli": "^5.0.0",
"redux-mock-store": "^1.5.3"
}
}
Loading