adding V0 schema for demo

This commit is contained in:
Vardan Bansal 2023-09-08 08:47:36 -07:00
parent 7fb900c42e
commit 376d7ed5f3
3 changed files with 75 additions and 2 deletions

View File

@ -18,7 +18,8 @@ import { useAppContext } from 'AppContext'
import type { CODEProps } from 'RouteDefinitions'
import { getErrorMessage } from 'utils/Utils'
import { decodeGitContent } from 'utils/GitUtils'
import pipelineSchema from './schema/pipeline-schema.json'
import pipelineSchemaV1 from './schema/pipeline-schema-v1.json'
import pipelineSchemaV0 from './schema/pipeline-schema-v0.json'
import { YamlVersion } from './Constants'
import css from './AddUpdatePipeline.module.scss'
@ -205,7 +206,7 @@ const AddUpdatePipeline = (): JSX.Element => {
<Container className={css.editorContainer}>
<MonacoSourceCodeEditor
language={'yaml'}
schema={version === YamlVersion.V0 ? {} : pipelineSchema}
schema={version === YamlVersion.V0 ? pipelineSchemaV0 : pipelineSchemaV1}
source={pipelineAsYAML}
onChange={(value: string) => setPipelineAsYaml(value)}
/>

View File

@ -0,0 +1,72 @@
{
"$schema": "http://json-schema.org/draft-07/schema#",
"type": "object",
"properties": {
"kind": {
"type": "string",
"enum": ["pipeline"]
},
"name": {
"type": "string"
},
"trigger": {
"type": "object",
"properties": {
"event": {
"type": "string"
},
"branch": {
"type": "array",
"items": {
"type": "string"
}
},
"path": {
"type": "array",
"items": {
"type": "string"
}
}
},
"required": ["event"]
},
"steps": {
"type": "array",
"items": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"image": {
"type": "string"
},
"commands": {
"type": "array",
"items": {
"type": "string"
}
},
"when": {
"type": "string",
"enum": ["on_success", "on_failure", "always"]
},
"depends_on": {
"type": "array",
"items": {
"type": "string"
}
},
"environment": {
"type": "object",
"additionalProperties": {
"type": "string"
}
}
},
"required": ["name", "commands"]
}
}
},
"required": ["kind", "name", "steps"]
}