From 3096da213d3e4369fb949c3d4df0bf0b1d60711b Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Tue, 20 Aug 2024 11:22:41 +0200 Subject: [PATCH] chore: add descriptions to JSON schema --- README.md | 8 ++++---- schema.json | 52 ++++++++++++++++++++++++++++++++++++---------------- 2 files changed, 40 insertions(+), 20 deletions(-) diff --git a/README.md b/README.md index a91504b..29e9fa5 100644 --- a/README.md +++ b/README.md @@ -5,13 +5,13 @@ Perfect for taking a production database and use locally. ## Install -For installation via composer -````bash +For installation via Composer +````shell $ composer require worksome/foggy ```` For installation in a Laravel application -```bash +```shell $ composer require worksome/foggy-laravel ``` @@ -108,7 +108,7 @@ In the following example we are calling the `email` faker. Sometimes you might want to use faker formatters which takes arguments. Arguments can be supplied by using the `params` key in the json object. -In the following example we specify that we only want to generate `female` names. +In the following example we specify that we only want to generate `male` names. ```json { diff --git a/schema.json b/schema.json index dc39382..955cd5f 100644 --- a/schema.json +++ b/schema.json @@ -1,19 +1,23 @@ { "$schema": "http://json-schema.org/draft-07/schema#", "type": "object", - "title": "The Root Schema", + "title": "Foggy Schema", + "description": "A Foggy (https://github.com/worksome/foggy) configuration.", "required": [ "database" ], "definitions": { "table": { "type": "object", + "description": "A representation of how a table should be dumped.", "properties": { "withData" : { - "type": "boolean" + "type": "boolean", + "description": "Whether the tables data should be included in the dump." }, "rules" : { "type": "array", + "description": "A configuration rule for a column.", "items": { "$ref": "#/definitions/rule" } @@ -21,38 +25,52 @@ }, "required": [ "withData" - ] + ], + "additionalProperties": false }, "rule": { "type": "object", + "description": "A representation of how a column should be dumped.", "properties": { "column": { - "type": "string" + "type": "string", + "description": "The name of the column." }, "type": { - "enum": [ - "faker", - "php", - "replace" - ] + "$ref": "#/definitions/ruleType", + "description": "The type of rule that should be used." }, "value": { - "type": "string" + "type": "string", + "description": "The value that should be used for the column." }, "condition": { - "type": "string" + "type": "string", + "description": "The conditional rule that has to pass before the rule is applied." }, "times": { - "type": "integer" + "type": "integer", + "description": "The number of times the rule is allowed to be applied." }, "params": { - "type": "string" + "type": "string", + "description": "A list of static pipe-separated (|) parameters to pass to the rule." } }, "required": [ "column", "type", "value" + ], + "additionalProperties": false + }, + "ruleType": { + "type": "string", + "description": "The type of rule to use.", + "enum": [ + "faker", + "php", + "replace" ] } }, @@ -60,12 +78,14 @@ "database": { "$id": "#/properties/database", "type": "object", - "title": "Holds all information of how the database should be dumped", + "title": "Database configuration", + "description": "A representation of how the database should be dumped.", "patternProperties": { "^.*$": { "$ref": "#/definitions/table" } } } - } -} \ No newline at end of file + }, + "additionalProperties": false +}