Skip to content

Commit

Permalink
add json schema to validate the class yaml files
Browse files Browse the repository at this point in the history
  • Loading branch information
mirpedrol committed Jul 22, 2024
1 parent dc2b091 commit dcfb633
Show file tree
Hide file tree
Showing 3 changed files with 91 additions and 0 deletions.
1 change: 1 addition & 0 deletions classes/alignment.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/mirpedrol/class-modules/main/classes/class-schema.json
name: "alignment"
description: Perform multiple sequence alignment
keywords:
Expand Down
89 changes: 89 additions & 0 deletions classes/class-schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"title": "Module class yaml",
"description": "Validate the yaml file for a module class",
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the class"
},
"description": {
"type": "string",
"description": "Description of the class"
},
"keywords": {
"type": "array",
"description": "Keywords for the class",
"items": {
"type": "string"
},
"minItems": 3
},
"input": {
"type": "array",
"description": "Input channels for the class modules",
"items": {
"type": "array",
"items": { "$ref": "#/definitions/elementProperties" }
}
},
"output": {
"type": "array",
"description": "Output channels for the class modules",
"items": {
"type": "object",
"items": { "$ref": "#/definitions/elementProperties" }
}
}
},
"definitions": {
"elementProperties": {
"type": "object",
"patternProperties": {
".*": {
"type": "object",
"properties": {
"type": {
"type": "string",
"description": "Type of the channel element",
"enum": ["map", "file", "directory", "string", "integer", "float", "boolean", "list"]
},
"description": {
"type": "string",
"description": "Description of the channel"
},
"pattern": {
"type": "string",
"description": "Pattern of the channel, given in Java glob syntax"
},
"enum": {
"type": "array",
"description": "List of allowed values for the channel",
"items": {
"type": ["string", "number", "boolean", "array", "object"]
},
"uniqueItems": true
},
"ontologies": {
"type": "array",
"description": "List of ontologies for the channel",
"uniqueItems": true,
"items": {
"type": "object",
"patternProperties": {
".*": {
"type": "string",
"pattern": "^(http|https)://.*"
}
}
}
}
},
"required": ["type", "description"]
}
}
}
},
"required": ["name", "description", "keywords", "input", "output"]
}
1 change: 1 addition & 0 deletions classes/guidetree.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/mirpedrol/class-modules/main/classes/class-schema.json
name: "guidetree"
description: Compute a guide tree for multiple sequence alignment
keywords:
Expand Down

0 comments on commit dcfb633

Please sign in to comment.