- Notifications
You must be signed in to change notification settings - Fork2
Validate yaml#28
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Merged
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
9 commits Select commitHold shift + click to select a range
c0e7cd0
validate yaml setup
ShMcKe44942d
outline yaml validation tests
ShMcKdd629dd
fix example structure
ShMcKfeec144
setup initial validate schema tests
ShMcK8cd8a88
refactor schema validation
ShMcK429cdf8
skeleton validation tests
ShMcKbc4dd2c
add skeleton validation
ShMcK016d4d6
fix build issue
ShMcK30985e4
exit early if yaml parsing fails
ShMcKFile filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
32 changes: 25 additions & 7 deletionssrc/build.ts
This file contains hidden or 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
4 changes: 0 additions & 4 deletionssrc/schema/meta.ts
This file contains hidden or 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
185 changes: 185 additions & 0 deletionssrc/schema/skeleton.ts
This file contains hidden or 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,185 @@ | ||
import meta from "./meta"; | ||
export default { | ||
title: "Skeleton Schema", | ||
description: | ||
"A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial", | ||
...meta, | ||
type: "object", | ||
properties: { | ||
version: { | ||
$ref: "#/definitions/semantic_version", | ||
description: "The tutorial version. Must be unique for the tutorial.", | ||
examples: ["0.1.0", "1.0.0"], | ||
}, | ||
// config | ||
config: { | ||
type: "object", | ||
properties: { | ||
testRunner: { | ||
type: "object", | ||
description: "The test runner configuration", | ||
properties: { | ||
command: { | ||
type: "string", | ||
description: "Command line to start the test runner", | ||
examples: ["./node_modules/.bin/mocha"], | ||
}, | ||
args: { | ||
type: "object", | ||
description: | ||
"A configuration of command line args for your test runner", | ||
properties: { | ||
filter: { | ||
type: "string", | ||
description: | ||
"the command line arg for filtering tests with a regex pattern", | ||
examples: ["--grep"], | ||
}, | ||
tap: { | ||
type: "string", | ||
description: | ||
"The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.", | ||
examples: ["--reporter=mocha-tap-reporter"], | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ["tap"], | ||
}, | ||
directory: { | ||
type: "string", | ||
description: "An optional folder for the test runner", | ||
examples: ["coderoad"], | ||
}, | ||
setup: { | ||
$ref: "#/definitions/setup_action", | ||
description: | ||
"Setup commits or commands used for setting up the test runner on tutorial launch", | ||
}, | ||
}, | ||
required: ["command", "args"], | ||
}, | ||
repo: { | ||
type: "object", | ||
description: "The repo holding the git commits for the tutorial", | ||
properties: { | ||
uri: { | ||
type: "string", | ||
description: "The uri source of the tutorial", | ||
format: "uri", | ||
examples: ["https://github.com/name/tutorial-name.git"], | ||
}, | ||
branch: { | ||
description: | ||
"The branch of the repo where the tutorial config file exists", | ||
type: "string", | ||
examples: ["master"], | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ["uri", "branch"], | ||
}, | ||
dependencies: { | ||
type: "array", | ||
description: "A list of tutorial dependencies", | ||
items: { | ||
type: "object", | ||
properties: { | ||
name: { | ||
type: "string", | ||
description: | ||
"The command line process name of the dependency. It will be checked by running `name --version`", | ||
examples: ["node", "python"], | ||
}, | ||
version: { | ||
type: "string", | ||
description: | ||
"The version requirement. See https://github.com/npm/node-semver for options", | ||
examples: [">=10"], | ||
}, | ||
}, | ||
required: ["name", "version"], | ||
}, | ||
}, | ||
appVersions: { | ||
type: "object", | ||
description: | ||
"A list of compatable coderoad versions. Currently only a VSCode extension.", | ||
properties: { | ||
vscode: { | ||
type: "string", | ||
description: | ||
"The version range for coderoad-vscode that this tutorial is compatable with", | ||
examples: [">=0.7.0"], | ||
}, | ||
}, | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ["testRunner", "repo"], | ||
}, | ||
// levels | ||
levels: { | ||
type: "array", | ||
description: | ||
'Levels are the stages a user goes through in the tutorial. A level may contain a group of tasks called "steps" that must be completed to proceed', | ||
items: { | ||
type: "object", | ||
properties: { | ||
id: { | ||
type: "string", | ||
description: "A level id", | ||
examples: ["L1", "L11"], | ||
}, | ||
setup: { | ||
$ref: "#/definitions/setup_action", | ||
description: | ||
"An optional point for loading commits, running commands or opening files", | ||
}, | ||
steps: { | ||
type: "array", | ||
items: { | ||
type: "object", | ||
properties: { | ||
id: { | ||
type: "string", | ||
description: "A level id", | ||
examples: ["L1S1", "L11S12"], | ||
}, | ||
setup: { | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/setup_action", | ||
description: | ||
"A point for loading commits. It can also run commands and/or open files", | ||
}, | ||
], | ||
}, | ||
solution: { | ||
allOf: [ | ||
{ | ||
$ref: "#/definitions/setup_action", | ||
description: | ||
"The solution commits that can be loaded if the user gets stuck. It can also run commands and/or open files", | ||
}, | ||
{ | ||
required: [], | ||
}, | ||
], | ||
}, | ||
}, | ||
required: ["id", "setup"], | ||
}, | ||
}, | ||
}, | ||
required: ["id"], | ||
}, | ||
minItems: 1, | ||
}, | ||
}, | ||
additionalProperties: false, | ||
required: ["version", "config", "levels"], | ||
}; |
3 changes: 3 additions & 0 deletionssrc/schema/index.ts → src/schema/tutorial.ts
This file contains hidden or 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
9 changes: 4 additions & 5 deletionssrc/templates/js-mocha/coderoad.yaml
This file contains hidden or 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
2 changes: 1 addition & 1 deletionsrc/utils/commits.ts
This file contains hidden or 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
11 changes: 5 additions & 6 deletionssrc/utils/parse.ts
This file contains hidden or 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
7 changes: 1 addition & 6 deletionssrc/utils/commitOrder.ts → src/utils/validateCommits.ts
This file contains hidden or 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
7 changes: 4 additions & 3 deletionssrc/utils/validateSchema.ts
This file contains hidden or 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
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.