Skip to content

Commit

Permalink
Merge pull request #1 from caido/ib-add-workflow-schema
Browse files Browse the repository at this point in the history
Add workflow schema
  • Loading branch information
Corb3nik authored Oct 28, 2024
2 parents 720d1d1 + 5480703 commit bc7d436
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@caido/plugin-manifest",
"version": "0.1.3",
"version": "0.2.0",
"description": "Validation for the plugin manifest",
"author": "Caido Labs Inc. <[email protected]>",
"license": "MIT",
Expand Down
15 changes: 11 additions & 4 deletions src/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,35 @@ import { describe, expect, it } from "vitest";
import { validateManifest } from "./validator.js";

describe("Manifest", () => {
it("Validate frontend manifest", () => {
it("validates frontend manifest", () => {
const data = JSON.parse(
fs.readFileSync("./tests/valid_frontend.json", "utf-8"),
);
expect(validateManifest(data)).toBe(true);
});

it("Validate fullstack manifest", () => {
it("validates workflow manifest", () => {
const data = JSON.parse(
fs.readFileSync("./tests/valid_workflow.json", "utf-8"),
);
expect(validateManifest(data)).toBe(true);
});

it("validates fullstack manifest", () => {
const data = JSON.parse(
fs.readFileSync("./tests/valid_fullstack.json", "utf-8"),
);
expect(validateManifest(data)).toBe(true);
});

it("Validate missing style manifest", () => {
it("validates missing style manifest", () => {
const data = JSON.parse(
fs.readFileSync("./tests/valid_missing_style.json", "utf-8"),
);
expect(validateManifest(data)).toBe(true);
});

it("Validate invalid version manifest", () => {
it("validates invalid version manifest", () => {
const data = JSON.parse(
fs.readFileSync("./tests/invalid_version.json", "utf-8"),
);
Expand Down
27 changes: 27 additions & 0 deletions src/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,33 @@
"$ref": "#/definitions/ManifestBackendPluginRuntime"
}
}
},
{
"type": "object",
"required": [
"id",
"kind",
"definition"
],
"properties": {
"id": {
"$ref": "#/definitions/ManifestID"
},
"kind": {
"type": "string",
"enum": [
"workflow"
]
},
"name": {
"type": [
"string"
]
},
"definition": {
"type": "string"
}
}
}
]
}
Expand Down
19 changes: 19 additions & 0 deletions tests/valid_workflow.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"id": "workflow-plugin",
"name": "Workflow Plugin",
"version": "0.1.0",
"description": "This is a workflow plugin",
"author": {
"name": "Caido Labs Inc.",
"email": "[email protected]",
"url": "https://github.com/caido/caido"
},
"plugins": [
{
"kind": "workflow",
"id": "caido-workflow",
"name": "Some workflow",
"definition": "workflow/definition.json"
}
]
}

0 comments on commit bc7d436

Please sign in to comment.