Skip to content
Open
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
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@openworkflowspec/sdk",
"version": "1.0.3-alpha6",
"version": "1.0.3-alpha7",
"schemaVersion": "1.0.3",
"supportedDslVersions": ">=1.0.0-0 <=1.0.3",
"description": "Typescript SDK for Open Workflow Specification",
Expand Down
26 changes: 26 additions & 0 deletions src/lib/schema.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* oUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

import type { SchemaObject } from 'ajv';
import workflowSchemaJson from './generated/schema/workflow.json';

/**
* THE JSON Schema of the Open Workflow DSL - the exact document that {@link validate} uses to validate workflows.
* Versioned by the specification not by this package: $id and package.json schemaVersion bit have DSL version it was generated from.
**/

export const workflowSchema: SchemaObject = workflowSchemaJson;
1 change: 1 addition & 0 deletions src/open-workflow-sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export * from './lib/errors';
export * from './lib/validation';
export * from './lib/graph-builder';
export * from './lib/mermaid-converter';
export * from './lib/schema';
31 changes: 31 additions & 0 deletions tests/validation/schema.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* Copyright 2021-Present The Open Workflow Specification Authors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* oUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*/

import { workflowSchema } from '../../src/lib/schema';
import { schemaVersion } from '../../package.json';

describe('workflowSchema', () => {
it('it is the same schema the validatior enforces', () => {
expect(workflowSchema.$id).toBe(`https://open-workflow-specification.org/schemas/${schemaVersion}/workflow.json`);
});

it('it carries the definitions consumers navigate by (smoke test)', () => {
expect(workflowSchema.$defs?.task).toBeDefined();
expect(workflowSchema.$defs?.taskList).toBeDefined();
expect(workflowSchema.$defs?.callTask).toBeDefined();
});
});