This repository has been archived by the owner on Oct 14, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 21
WIP on schemas for the experiment APIs - for review by all #135
Merged
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
4388b6a
WIP re #121
gregglind 7b10237
Building schema.json during npm run build
motin 5a7f984
Not tracking schema.json (for making yaml-focused diffs easier to rev…
motin 8705e5e
WIP: added sample study using the api
gregglind c798997
Minimal changes to reach valid syntax
motin 91a83af
Npm run format
motin 3c18e13
Added minimal boilerplate to be able to launch examples/small-study
motin 6f15bf9
WIP to make fakeApi
gregglind 2e4bd9a
WIP on revised api
gregglind 837d18c
More WIP. Not happy with how it's going
gregglind a9ffa82
WIP to fix linting. Local tests fail.
gregglind 305eba5
format results
gregglind 7ca4198
WIP, tests still broken. Moving toward one file for study, one for b…
gregglind 8d79f5e
Continuing work on simple study, including schema work
gregglind c310a22
Simpler activation
gregglind 34fa991
Vastly simplified API, including new background and study files. All…
gregglind fd0f4c6
WIP some schema naming, added wee-schema validation
gregglind bc1db5b
Candidate fix #121.
gregglind e7e4161
RC2 of api.
gregglind a57ba30
Known issue with schema for studySetup, will fix in morning.
gregglind d8b43d3
WIP, rc3
gregglind 910ff11
WIP on verifying schemas. Fx is still not liking the validation
gregglind 84cd21e
Fixed all schemas.
gregglind 4cdba0a
Added 'browser.study.log(stringOrArray)'
gregglind 24e6841
Documentation for the api, autogenerate by `npm run apiDocs`
gregglind 59ebeff
First attempt at README improvements. Not sure if relative links work
gregglind 31e6fe9
Readme, docs, minor nits and typos
gregglind f22b267
Fixing the header table
gregglind 608f8b9
Linting and formatting
motin fc8a2ea
Using npm prepare instead of prepack (https://github.com/npm/npm/issu…
motin e03ffe1
Updated list of files to include in npm package
motin 6828cc7
Gitignore cleanup
motin c13d6cf
Updated package-lock.json
motin 436aed6
Make webExtensionApis/api.js and schema.json included in the npm package
motin 1fe9073
Mention of how to get working develop version using npm install
gregglind 6bc9bc9
new tool: copyStudyUtils, as a command. Final in 121
gregglind 3b5d9df
Post format
gregglind 4f1f117
README fixes
gregglind File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
This file contains 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,65 @@ | ||
|
||
/** | ||
* given a propose wee interface schama.json, lint and check it for | ||
* validity | ||
*/ | ||
// given a proposed WEE schema attept to validate it, including. | ||
|
||
const path = require("path"); | ||
|
||
const proposed = require(path.resolve(process.argv[2])); | ||
// const weeSchemaSchema = require(path.resolve("./wee-schema-schema.json")); | ||
|
||
const ajv = new require("ajv")() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want to add
|
||
|
||
// 1. is eevery 'type' and every 'parameter' valid | ||
for (let i in proposed) { | ||
let ns = proposed[i]; | ||
for (let j in ns.types || []) { | ||
let type = ns.types[j]; | ||
let valid = ajv.validateSchema(type); | ||
if (!valid) { | ||
console.error(`# ERRORS IN ${i}:${j} ${ns.namespace}.types[${j}] "${type.id}"`) | ||
console.error(ajv.errors) | ||
} | ||
|
||
// checking test cases if any | ||
if (!type.testcase) continue | ||
valid = ajv.validate(type, type.testcase); | ||
if (!valid) { | ||
console.error(`# testcase failed IN ${i}:${j} ${ns.namespace}.types[${j}] "${type.id}"`) | ||
console.error(ajv.errors) | ||
} | ||
} | ||
|
||
} | ||
|
||
|
||
// 2. is every 'parameter' valid | ||
for (let i in proposed) { | ||
let ns = proposed[i]; | ||
for (let j in ns.functions || []) { | ||
let type = ns.functions[j]; | ||
for (let k in type.parameters) { | ||
let parameter = type.parameters[k] | ||
let valid = ajv.validateSchema(parameter); | ||
if (!valid) { | ||
console.error(`# ERRORS IN ${i}:${j} ${type.name} ${ns.namespace}.functions[${j}].paramters[${k}]`) | ||
console.error(ajv.errors) | ||
debugger; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rogue debugger statement? |
||
} | ||
} | ||
} | ||
for (let j in ns.events || []) { | ||
let type = ns.events[j]; | ||
for (let k in type.parameters) { | ||
let parameter = type.parameters[k] | ||
let valid = ajv.validateSchema(parameter); | ||
if (!valid) { | ||
console.error(`# ERRORS IN ${i}:${j} ${type.name} ${ns.namespace}.events[${j}].parameters[${k}]`) | ||
console.error(ajv.errors) | ||
} | ||
} | ||
} | ||
} | ||
|
This file contains 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
This file contains 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
This file contains 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aswan Is there a standardized/documented process to validate WEE API
schema.json
?