|
| 1 | +importmetafrom"./meta"; |
| 2 | + |
| 3 | +exportdefault{ |
| 4 | +title:"Skeleton Schema", |
| 5 | +description: |
| 6 | +"A CodeRoad tutorial config schema. This data is paired up with the markdown to create a tutorial", |
| 7 | + ...meta, |
| 8 | +type:"object", |
| 9 | +properties:{ |
| 10 | +version:{ |
| 11 | +$ref:"#/definitions/semantic_version", |
| 12 | +description:"The tutorial version. Must be unique for the tutorial.", |
| 13 | +examples:["0.1.0","1.0.0"], |
| 14 | +}, |
| 15 | + |
| 16 | +// config |
| 17 | +config:{ |
| 18 | +type:"object", |
| 19 | +properties:{ |
| 20 | +testRunner:{ |
| 21 | +type:"object", |
| 22 | +description:"The test runner configuration", |
| 23 | +properties:{ |
| 24 | +command:{ |
| 25 | +type:"string", |
| 26 | +description:"Command line to start the test runner", |
| 27 | +examples:["./node_modules/.bin/mocha"], |
| 28 | +}, |
| 29 | +args:{ |
| 30 | +type:"object", |
| 31 | +description: |
| 32 | +"A configuration of command line args for your test runner", |
| 33 | +properties:{ |
| 34 | +filter:{ |
| 35 | +type:"string", |
| 36 | +description: |
| 37 | +"the command line arg for filtering tests with a regex pattern", |
| 38 | +examples:["--grep"], |
| 39 | +}, |
| 40 | +tap:{ |
| 41 | +type:"string", |
| 42 | +description: |
| 43 | +"The command line arg for configuring a TAP reporter. See https://github.com/sindresorhus/awesome-tap for examples.", |
| 44 | +examples:["--reporter=mocha-tap-reporter"], |
| 45 | +}, |
| 46 | +}, |
| 47 | +additionalProperties:false, |
| 48 | +required:["tap"], |
| 49 | +}, |
| 50 | +directory:{ |
| 51 | +type:"string", |
| 52 | +description:"An optional folder for the test runner", |
| 53 | +examples:["coderoad"], |
| 54 | +}, |
| 55 | +setup:{ |
| 56 | +$ref:"#/definitions/setup_action", |
| 57 | +description: |
| 58 | +"Setup commits or commands used for setting up the test runner on tutorial launch", |
| 59 | +}, |
| 60 | +}, |
| 61 | +required:["command","args"], |
| 62 | +}, |
| 63 | +repo:{ |
| 64 | +type:"object", |
| 65 | +description:"The repo holding the git commits for the tutorial", |
| 66 | +properties:{ |
| 67 | +uri:{ |
| 68 | +type:"string", |
| 69 | +description:"The uri source of the tutorial", |
| 70 | +format:"uri", |
| 71 | +examples:["https://github.com/name/tutorial-name.git"], |
| 72 | +}, |
| 73 | +branch:{ |
| 74 | +description: |
| 75 | +"The branch of the repo where the tutorial config file exists", |
| 76 | +type:"string", |
| 77 | +examples:["master"], |
| 78 | +}, |
| 79 | +}, |
| 80 | +additionalProperties:false, |
| 81 | +required:["uri","branch"], |
| 82 | +}, |
| 83 | + |
| 84 | +dependencies:{ |
| 85 | +type:"array", |
| 86 | +description:"A list of tutorial dependencies", |
| 87 | +items:{ |
| 88 | +type:"object", |
| 89 | +properties:{ |
| 90 | +name:{ |
| 91 | +type:"string", |
| 92 | +description: |
| 93 | +"The command line process name of the dependency. It will be checked by running `name --version`", |
| 94 | +examples:["node","python"], |
| 95 | +}, |
| 96 | +version:{ |
| 97 | +type:"string", |
| 98 | +description: |
| 99 | +"The version requirement. See https://github.com/npm/node-semver for options", |
| 100 | +examples:[">=10"], |
| 101 | +}, |
| 102 | +}, |
| 103 | +required:["name","version"], |
| 104 | +}, |
| 105 | +}, |
| 106 | +appVersions:{ |
| 107 | +type:"object", |
| 108 | +description: |
| 109 | +"A list of compatable coderoad versions. Currently only a VSCode extension.", |
| 110 | +properties:{ |
| 111 | +vscode:{ |
| 112 | +type:"string", |
| 113 | +description: |
| 114 | +"The version range for coderoad-vscode that this tutorial is compatable with", |
| 115 | +examples:[">=0.7.0"], |
| 116 | +}, |
| 117 | +}, |
| 118 | +}, |
| 119 | +}, |
| 120 | +additionalProperties:false, |
| 121 | +required:["testRunner","repo"], |
| 122 | +}, |
| 123 | + |
| 124 | +// levels |
| 125 | +levels:{ |
| 126 | +type:"array", |
| 127 | +description: |
| 128 | +'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', |
| 129 | +items:{ |
| 130 | +type:"object", |
| 131 | +properties:{ |
| 132 | +id:{ |
| 133 | +type:"string", |
| 134 | +description:"A level id", |
| 135 | +examples:["L1","L11"], |
| 136 | +}, |
| 137 | +setup:{ |
| 138 | +$ref:"#/definitions/setup_action", |
| 139 | +description: |
| 140 | +"An optional point for loading commits, running commands or opening files", |
| 141 | +}, |
| 142 | +steps:{ |
| 143 | +type:"array", |
| 144 | +items:{ |
| 145 | +type:"object", |
| 146 | +properties:{ |
| 147 | +id:{ |
| 148 | +type:"string", |
| 149 | +description:"A level id", |
| 150 | +examples:["L1S1","L11S12"], |
| 151 | +}, |
| 152 | +setup:{ |
| 153 | +allOf:[ |
| 154 | +{ |
| 155 | +$ref:"#/definitions/setup_action", |
| 156 | +description: |
| 157 | +"A point for loading commits. It can also run commands and/or open files", |
| 158 | +}, |
| 159 | +], |
| 160 | +}, |
| 161 | +solution:{ |
| 162 | +allOf:[ |
| 163 | +{ |
| 164 | +$ref:"#/definitions/setup_action", |
| 165 | +description: |
| 166 | +"The solution commits that can be loaded if the user gets stuck. It can also run commands and/or open files", |
| 167 | +}, |
| 168 | +{ |
| 169 | +required:[], |
| 170 | +}, |
| 171 | +], |
| 172 | +}, |
| 173 | +}, |
| 174 | +required:["id","setup"], |
| 175 | +}, |
| 176 | +}, |
| 177 | +}, |
| 178 | +required:["id"], |
| 179 | +}, |
| 180 | +minItems:1, |
| 181 | +}, |
| 182 | +}, |
| 183 | +additionalProperties:false, |
| 184 | +required:["version","config","levels"], |
| 185 | +}; |