Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publish a JSON Schema #556

Merged
merged 4 commits into from
Jan 28, 2022
Merged
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
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 @@ -71,6 +71,9 @@ jinja2==2.11.3
# via
# -r requirements/prod.txt
# mkdocs
jsonschema==4.2.1
# via
# -r requirements/dev.txt
markdown==3.3.6
# 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