-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: pogi7 <[email protected]>
- Loading branch information
Showing
7 changed files
with
99 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* Defines the structure of the JSON object that is received from the JSON files in the commands directory. | ||
* | ||
* @field name - The name of the command | ||
* @field id - The id of the command | ||
* @field command - The command object | ||
* | ||
*/ | ||
export default interface ICommandSchema { | ||
name: string; | ||
id: string; | ||
command: Command; | ||
} | ||
|
||
/** | ||
* Defines the structure of the command | ||
* | ||
* @field type - CRUD command | ||
* | ||
*/ | ||
interface Command { | ||
type: string; | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import ICommandSchema from '../interfaces/ICommandSchema'; | ||
import { JSONSchemaType } from "ajv"; | ||
|
||
/** | ||
* This JSON schema is used with AJV to validate JSON files stored in the commands directory that is stored within OML models. | ||
* | ||
* @remarks | ||
* This constant will help validate JSON data using {@link https://ajv.js.org | AJV}. | ||
* | ||
* The data within the constant was generated with {@link https://www.jsonschema.net | JSON Schema}. | ||
* | ||
*/ | ||
|
||
export const commandSchema: JSONSchemaType<ICommandSchema[]> = { | ||
"$schema": "http://json-schema.org/draft-07/schema#", | ||
"type": "array", | ||
"items": { | ||
"type": "object", | ||
"properties": { | ||
"name": { | ||
"type": "string" | ||
}, | ||
"id": { | ||
"type": "string" | ||
}, | ||
"command": { | ||
"type": "object", | ||
"properties": { | ||
"type": { | ||
"type": "string" | ||
} | ||
}, | ||
"required": ["type"] | ||
} | ||
}, | ||
"required": ["name", "id", "command"] | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters