feat(fake-driver): add a schema
Adds an example schema to `fake-driver`. This is used for testing.
Also simplify assignment of commands to `FakeDriver.prototype`.
MODIFY
packages/fake-driver/lib/driver.js
packages/fake-driver/lib/driver.js
@@ -101,8 +101,6 @@ class FakeDriver extends BaseDriver {
}
-for (let [cmd, fn] of _.toPairs(commands)) {
- FakeDriver.prototype[cmd] = fn;
-}
+Object.assign(FakeDriver.prototype, commands);
export { FakeDriver };

ADD
packages/fake-driver/lib/fake-driver-schema.js
+// this could be a .json file, too:
+// {
+// "$schema": "http://json-schema.org/draft-07/schema",
+// "$id": "https://appium.io/fake-driver.json",
+// "type": "object",
+// "title": "Fake Driver Configuration",
+// "description": "A schema for Fake Driver arguments",
+// "properties": {
+// "answer": {
+// "type": "number",
+// "description": "The answer to life, the universe, and everything",
+// "default": 42
+// }
+// }
+// }
+
+
+export default {
+ type: 'object',
+ title: 'Fake Driver Configuration',
+ description: 'A schema for Fake Driver arguments',
+ properties: {
+ // the prop name will always be normalized to camelCase
+ 'silly-web-server-port': {
+ type: 'integer',
+ minimum: 1,
+ maximum: 65535,
+ description: 'The port to use for the fake web server',
+ },
+ sillyWebServerHost: {
+ type: 'string',
+ description: 'The host to use for the fake web server',
+ default: 'sillyhost'
+ }
+ }
+};

MODIFY
packages/fake-driver/package.json
packages/fake-driver/package.json
"Fake"
],
"mainClass": "FakeDriver",
+ "schema": "./build/lib/fake-driver-schema.js",
"scripts": {
"fake-error": "./build/lib/scripts/fake-error.js",
"fake-success": "./build/lib/scripts/fake-success.js"

feat(fake-driver): add a schema

Adds an example schema to `fake-driver`. This is used for testing.
Also simplify assignment of commands to `FakeDriver.prototype`.