Skip to content

Commit

Permalink
chore: add descriptions to JSON schema
Browse files Browse the repository at this point in the history
  • Loading branch information
owenvoke committed Aug 20, 2024
1 parent 85113c9 commit 9ac0c35
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 19 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down Expand Up @@ -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
{
Expand Down
49 changes: 34 additions & 15 deletions schema.json
Original file line number Diff line number Diff line change
@@ -1,71 +1,90 @@
{
"$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"
}
}
},
"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",
"enum": [
"faker",
"php",
"replace"
]
}
},
"properties": {
"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"
}
}
}
}
},
"additionalProperties": false
}

0 comments on commit 9ac0c35

Please sign in to comment.