Skip to content

Commit

Permalink
- Add a JSON Schema for Snowfakery
Browse files Browse the repository at this point in the history
- Add example files for testing
- Add new snowcheck tool
  • Loading branch information
Paul Prescod committed Dec 1, 2021
1 parent d0bf682 commit 1e26024
Show file tree
Hide file tree
Showing 11 changed files with 337 additions and 89 deletions.
88 changes: 0 additions & 88 deletions examples/salesforce/CommunityUsers.yml

This file was deleted.

3 changes: 2 additions & 1 deletion requirements/dev.in
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ tox
tox-gh-actions # needed for CI only
pytest-vcr
vcrpy
responses
responses
jsonschema
3 changes: 3 additions & 0 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ jinja2==2.11.3
# via
# -r requirements/prod.txt
# mkdocs
jsonschema==4.2.1
# via
# -r requirements/dev.txt
markdown==3.3.4
# via mkdocs
markupsafe==2.0.1
Expand Down
17 changes: 17 additions & 0 deletions schema/example.recipe.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# yaml-language-server: $schema=snowfakery_recipe.jsonschema.json
- include_file: foo.yml
- object: Account
nickname: An ice sculpture
count: abcdee
fields:
a: blah
friends:
- object: q
- object: Contact
nickname: A blue mouse
count: 5
- var: xxxx
value: jiojoioj
fjkioesjkf: fjeiosjfosi
fioesjfoi: fjieosjfso

235 changes: 235 additions & 0 deletions schema/snowfakery_recipe.jsonschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,235 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"$id": "http://github.com/SFDO-Tooling/Snowfakery/schema/snowfakery_recipe.jsonschema.json",
"description": "Snowfakery recipe schema",
"title": "Snowfakery Recipe",
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"$ref": "#/$defs/include_file"
},
{
"$ref": "#/$defs/var"
},
{
"$ref": "#/$defs/macro"
},
{
"$ref": "#/$defs/plugin"
},
{
"$ref": "#/$defs/option"
}
]
},
"$defs": {
"object": {
"title": "Object Template",
"type": "object",
"additionalProperties": false,
"properties": {
"object": {
"description": "The object name",
"type": "string"
},
"nickname": {
"type": "string"
},
"just_once": {
"type": "boolean"
},
"count": {
"anyOf": [
{
"type": "number"
},
{
"type": "string"
},
{
"type": "object"
}
]
},
"fields": {
"type": "object",
"additionalProperties": true
},
"friends": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"$ref": "#/$defs/var"
}
]
}
},
"include": {
"type": "string"
}
},
"required": [
"object"
]
},
"include_file": {
"title": "Include File",
"type": "object",
"additionalProperties": false,
"properties": {
"include_file": {
"description": "The file name",
"type": "string"
}
},
"required": [
"include_file"
]
},
"plugin": {
"title": "Plugin Declaration",
"type": "object",
"additionalProperties": false,
"properties": {
"plugin": {
"description": "The plugin name",
"type": "string"
}
},
"required": [
"plugin"
]
},
"var": {
"title": "Variable",
"type": "object",
"additionalProperties": false,
"properties": {
"var": {
"description": "The var name",
"type": "string"
},
"value": {
"description": "The value",
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"$ref": "#/$defs/var"
}
]
}
}
]
}
},
"required": [
"var",
"value"
]
},
"option": {
"title": "Variable",
"type": "object",
"additionalProperties": false,
"properties": {
"option": {
"description": "The var name",
"type": "string"
},
"default": {
"description": "The value",
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"type": "string"
},
{
"type": "number"
},
{
"type": "object"
},
{
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"$ref": "#/$defs/var"
}
]
}
}
]
}
},
"required": [
"option"
]
},
"macro": {
"title": "Macro",
"type": "object",
"additionalProperties": false,
"properties": {
"macro": {
"description": "The object name",
"type": "string"
},
"include": {
"type": "string"
},
"fields": {
"type": "object",
"additionalProperties": true
},
"friends": {
"type": "array",
"items": {
"anyOf": [
{
"$ref": "#/$defs/object"
},
{
"$ref": "#/$defs/var"
}
]
}
}
},
"required": [
"macro"
]
}
}
}
Loading

0 comments on commit 1e26024

Please sign in to comment.