feat: add solution code and enhance validation rules for basic selectors lesson
This commit is contained in:
@@ -193,6 +193,7 @@
|
|||||||
"initialCode": "",
|
"initialCode": "",
|
||||||
"codeSuffix": "",
|
"codeSuffix": "",
|
||||||
"previewContainer": "preview-area",
|
"previewContainer": "preview-area",
|
||||||
|
"solution": ".card.featured { border-color: gold; background-color: lemonchiffon }",
|
||||||
"validations": [
|
"validations": [
|
||||||
{
|
{
|
||||||
"type": "regex",
|
"type": "regex",
|
||||||
@@ -215,6 +216,11 @@
|
|||||||
},
|
},
|
||||||
"message": "Set the border color to <kbd>gold</kbd>"
|
"message": "Set the border color to <kbd>gold</kbd>"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"type": "regex",
|
||||||
|
"value": "\\.card\\.featured\\s*{[^}]*;",
|
||||||
|
"message": "Make sure to end your CSS rule with a semicolon <kbd>;</kbd>"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"type": "contains",
|
"type": "contains",
|
||||||
"value": "background-color:",
|
"value": "background-color:",
|
||||||
|
|||||||
@@ -1,146 +1,150 @@
|
|||||||
{
|
{
|
||||||
"$schema": "http://json-schema.org/draft-07/schema#",
|
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||||
"title": "Code Crispies Module Schema",
|
"title": "Code Crispies Module Schema",
|
||||||
"description": "Schema for CSS course modules with lessons",
|
"description": "Schema for CSS course modules with lessons",
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["id", "title", "description", "difficulty", "lessons"],
|
"required": ["id", "title", "description", "difficulty", "lessons"],
|
||||||
"properties": {
|
"properties": {
|
||||||
"id": {
|
"id": {
|
||||||
"type": "string",
|
|
||||||
"description": "Unique identifier for the module"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Title of the module"
|
|
||||||
},
|
|
||||||
"description": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Detailed description of the module content and purpose"
|
|
||||||
},
|
|
||||||
"difficulty": {
|
|
||||||
"type": "string",
|
|
||||||
"enum": ["beginner", "intermediate", "advanced"],
|
|
||||||
"description": "Difficulty level of the module"
|
|
||||||
},
|
|
||||||
"lessons": {
|
|
||||||
"type": "array",
|
|
||||||
"description": "Collection of lessons within the module",
|
|
||||||
"minItems": 1,
|
|
||||||
"items": {
|
|
||||||
"type": "object",
|
|
||||||
"required": [
|
|
||||||
"id",
|
|
||||||
"title",
|
|
||||||
"description",
|
|
||||||
"task",
|
|
||||||
"previewHTML",
|
|
||||||
"previewBaseCSS",
|
|
||||||
"sandboxCSS",
|
|
||||||
"codePrefix",
|
|
||||||
"initialCode",
|
|
||||||
"codeSuffix",
|
|
||||||
"previewContainer",
|
|
||||||
"validations"
|
|
||||||
],
|
|
||||||
"properties": {
|
|
||||||
"id": {
|
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Unique identifier for the lesson"
|
"description": "Unique identifier for the module"
|
||||||
},
|
},
|
||||||
"title": {
|
"title": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Title of the lesson"
|
"description": "Title of the module"
|
||||||
},
|
},
|
||||||
"description": {
|
"description": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Detailed description of the lesson content and concepts"
|
"description": "Detailed description of the module content and purpose"
|
||||||
},
|
},
|
||||||
"task": {
|
"difficulty": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "The specific task instructions for the student to complete"
|
"enum": ["beginner", "intermediate", "advanced"],
|
||||||
},
|
"description": "Difficulty level of the module"
|
||||||
"previewHTML": {
|
},
|
||||||
"type": "string",
|
"lessons": {
|
||||||
"description": "HTML content used for the interactive preview"
|
|
||||||
},
|
|
||||||
"previewBaseCSS": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Base CSS styles applied to the preview environment"
|
|
||||||
},
|
|
||||||
"sandboxCSS": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Additional CSS for the sandbox environment"
|
|
||||||
},
|
|
||||||
"codePrefix": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Code that appears before the editable area"
|
|
||||||
},
|
|
||||||
"initialCode": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Initial code provided in the editor"
|
|
||||||
},
|
|
||||||
"codeSuffix": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Code that appears after the editable area"
|
|
||||||
},
|
|
||||||
"previewContainer": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "ID of the container element for the preview"
|
|
||||||
},
|
|
||||||
"validations": {
|
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"description": "Rules to validate user input",
|
"description": "Collection of lessons within the module",
|
||||||
"minItems": 1,
|
"minItems": 1,
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"required": ["type", "value", "message"],
|
"required": [
|
||||||
"properties": {
|
"id",
|
||||||
"type": {
|
"title",
|
||||||
"type": "string",
|
"description",
|
||||||
"enum": ["contains", "not_contains", "regex", "property_value", "syntax", "custom"],
|
"task",
|
||||||
"description": "Type of validation to perform"
|
"previewHTML",
|
||||||
},
|
"previewBaseCSS",
|
||||||
"value": {
|
"sandboxCSS",
|
||||||
"description": "Value to check against, format depends on validation type",
|
"codePrefix",
|
||||||
"oneOf": [
|
"initialCode",
|
||||||
{
|
"codeSuffix",
|
||||||
"type": "string"
|
"previewContainer",
|
||||||
|
"validations"
|
||||||
|
],
|
||||||
|
"properties": {
|
||||||
|
"id": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Unique identifier for the lesson"
|
||||||
},
|
},
|
||||||
{
|
"title": {
|
||||||
"type": "object",
|
"type": "string",
|
||||||
"required": ["property", "expected"],
|
"description": "Title of the lesson"
|
||||||
"properties": {
|
},
|
||||||
"property": {
|
"description": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "CSS property name to validate"
|
"description": "Detailed description of the lesson content and concepts"
|
||||||
},
|
},
|
||||||
"expected": {
|
"task": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "Expected value for the CSS property"
|
"description": "The specific task instructions for the student to complete"
|
||||||
|
},
|
||||||
|
"previewHTML": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "HTML content used for the interactive preview"
|
||||||
|
},
|
||||||
|
"previewBaseCSS": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Base CSS styles applied to the preview environment"
|
||||||
|
},
|
||||||
|
"sandboxCSS": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Additional CSS for the sandbox environment"
|
||||||
|
},
|
||||||
|
"codePrefix": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Code that appears before the editable area"
|
||||||
|
},
|
||||||
|
"initialCode": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Initial code provided in the editor"
|
||||||
|
},
|
||||||
|
"codeSuffix": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Code that appears after the editable area"
|
||||||
|
},
|
||||||
|
"solution": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Solution code for the lesson, if applicable"
|
||||||
|
},
|
||||||
|
"previewContainer": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "ID of the container element for the preview"
|
||||||
|
},
|
||||||
|
"validations": {
|
||||||
|
"type": "array",
|
||||||
|
"description": "Rules to validate user input",
|
||||||
|
"minItems": 1,
|
||||||
|
"items": {
|
||||||
|
"type": "object",
|
||||||
|
"required": ["type", "value", "message"],
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["contains", "not_contains", "regex", "property_value", "syntax", "custom"],
|
||||||
|
"description": "Type of validation to perform"
|
||||||
|
},
|
||||||
|
"value": {
|
||||||
|
"description": "Value to check against, format depends on validation type",
|
||||||
|
"oneOf": [
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"required": ["property", "expected"],
|
||||||
|
"properties": {
|
||||||
|
"property": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "CSS property name to validate"
|
||||||
|
},
|
||||||
|
"expected": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Expected value for the CSS property"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"message": {
|
||||||
|
"type": "string",
|
||||||
|
"description": "Feedback message shown when validation fails"
|
||||||
|
},
|
||||||
|
"options": {
|
||||||
|
"type": "object",
|
||||||
|
"description": "Additional options for validation",
|
||||||
|
"properties": {
|
||||||
|
"caseSensitive": {
|
||||||
|
"type": "boolean",
|
||||||
|
"description": "Whether the validation should be case sensitive"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
]
|
|
||||||
},
|
|
||||||
"message": {
|
|
||||||
"type": "string",
|
|
||||||
"description": "Feedback message shown when validation fails"
|
|
||||||
},
|
|
||||||
"options": {
|
|
||||||
"type": "object",
|
|
||||||
"description": "Additional options for validation",
|
|
||||||
"properties": {
|
|
||||||
"caseSensitive": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Whether the validation should be case sensitive"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user