UNPKG

pimatic

Version:

A home automation server and framework for the Raspberry PI running on node.js

423 lines (414 loc) 13.5 kB
[ { "description": "format date-time", "schema": { "type": "string", "format": "date-time" }, "tests": [ { "description": "matches schema", "data": "2013-02-08T03:40:15Z", "valid": true }, { "description": "matches schema with time-offset", "data": "2013-02-08T03:40:15-08:00", "valid": true }, { "description": "matches schema (leap second)", "data": "1998-12-31T23:59:60Z", "valid": true }, { "description": "does not match schema (invalid mday)", "data": "2013-02-29T03:40:15Z", "valid": false }, { "description": "does not match schema (no time-offset)", "data": "2013-02-29T03:40:15", "valid": false }, { "description": "does not match schema (hour 24 not allowed)", "data": "2013-02-08T24:40:15-08:00Z", "valid": false } ] }, { "description": "format date", "schema": { "type": "string", "format": "date" }, "tests": [ { "description": "matches schema", "data": "2013-02-08", "valid": true }, { "description": "does not match schema (invalid mday)", "data": "2013-02-29", "valid": false } ] }, { "description": "format time", "schema": { "type": "string", "format": "time" }, "tests": [ { "description": "matches schema", "data": "03:40:15", "valid": true }, { "description": "matches schema (with fractional seconds)", "data": "03:40:15.0123", "valid": true }, { "description": "does not match schema (hour 24 not allowed)", "data": "24:40:15", "valid": false } ] }, { "description": "format hostname", "schema": { "type": "string", "format": "hostname" }, "tests": [ { "description": "matches schema", "data": "google.com", "valid": true }, { "description": "matches schema (mixed case)", "data": "YaHoO.CoM", "valid": true }, { "description": "matches schema (only one label)", "data": "localhost", "valid": true }, { "description": "matches schema (contains hyphens)", "data": "localhost-here.and-there.example.com", "valid": true }, { "description": "matches schema (contains digits)", "data": "localhost-here9.foo99bar.example.com", "valid": true }, { "description": "matches schema (longer name)", "data": "the.eagle.flies.at.midnight.example.com", "valid": true }, { "description": "matches schema (long label)", "data": "pneumonoultramicroscopicsilicovolcanoconiosis-cryptocrystalline.org", "valid": true }, { "description": "does not match schema (unacceptable chars)", "data": "my!domain.example.com", "valid": false }, { "description": "does not match schema (terminal dot not allowed (!) by RFC 1034 3.5)", "data": "google.com.", "valid": false }, { "description": "does not match schema (too-long label)", "data": "pneumonoultramicroscopicsilicovolcanoconiosis-electrocardiograms.org", "valid": false }, { "description": "does not match schema (label can't start with a hyphen)", "data": "-minus.org", "valid": false }, { "description": "does not match schema (label can't end with a hyphen)", "data": "minus-.com", "valid": false }, { "description": "does not match schema (IPv4 address is not a hostname)", "data": "127.0.0.1", "valid": false } ] }, { "description": "email", "schema": { "type": "string", "format": "email" }, "tests": [ { "description": "matches schema", "data": "first.last@example.com", "valid": true }, { "description": "matches schema with single-part domain", "data": "root@localhost", "valid": true }, { "description": "matches schema with Gmail-style + address", "data": "first.last+nospam@example.com", "valid": true }, { "description": "matches schema (mixed case)", "data": "UsEr@ExAmPlE.CoM", "valid": true }, { "description": "matches schema (unusual but valid characters)", "data": "!#$%&'*+=/?^_`{|}~-@example.com", "valid": true }, { "description": "does not match schema (no domain part)", "data": "user", "valid": false }, { "description": "does not match schema (missing local part)", "data": "@gmail.com", "valid": false }, { "description": "does not match schema (missing domain part)", "data": "user@", "valid": false }, { "description": "does not match schema (double @)", "data": "user@domain.com@example.com", "valid": false } ] }, { "description": "format ipv4", "schema": { "type": "string", "format": "ipv4" }, "tests": [ { "description": "matches schema", "data": "10.11.12.13", "valid": true }, { "description": "matches schema (boundary conditions)", "data": "255.255.255.0", "valid": true }, { "description": "does not match schema", "data": "10.11.12", "valid": false }, { "description": "does not match schema (out of bounds IPv4 address)", "data": "256.11.12.13", "valid": false }, { "description": "does not match schema (out of bounds IPv4 address)", "data": "10.11.12.256", "valid": false } ] }, { "description": "format ipv6", "schema": { "type": "string", "format": "ipv6" }, "tests": [ { "description": "matches schema (form 1 test 1)", "data": "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210", "valid": true }, { "description": "matches schema (form 1 test 2)", "data": "1080:0:0:0:8:800:200C:417A", "valid": true }, { "description": "matches schema (form 1 test 3)", "data": "fedc:ba98:7654:3210:fedc:ba98:7654:3210", "valid": true }, { "description": "matches schema (form 2 test 1)", "data": "1080::8:800:200C:417A", "valid": true }, { "description": "matches schema (form 2 test 2)", "data": "FF01::101", "valid": true }, { "description": "matches schema (form 2 test 3)", "data": "::1", "valid": true }, { "description": "matches schema (form 2 test 4)", "data": "::", "valid": true }, { "description": "matches schema (form 3 test 1)", "data": "0:0:0:0:0:0:13.1.68.3", "valid": true }, { "description": "matches schema (form 3 test 2)", "data": "0:0:0:0:0:FFFF:129.144.52.38", "valid": true }, { "description": "matches schema (form 3 test 3)", "data": "::13.1.68.3", "valid": true }, { "description": "matches schema (form 3 test 4)", "data": "::FFFF:129.144.52.38", "valid": true }, { "description": "matches schema (form 3 test 5)", "data": "FEED:BEEF::FFFF:129.144.52.38", "valid": true }, { "description": "does not match schema (too many elements)", "data": "FEDC:BA98:7654:3210:FEDC:BA98:7654:3210:BEEF", "valid": false }, { "description": "does not match schema (too few elements)", "data": "FEDC:BA98:7654:3210:FEDC:BA98", "valid": false }, { "description": "does not match schema (non-hex element)", "data": "FEDC:BA98:7654:3210:FEDC:BA98:7654:FOOL", "valid": false }, { "description": "does not match schema (double colon too many elements)", "data": "FEDC:BA98:7654:3210:FEDC:BA98:7654::3210", "valid": false }, { "description": "does not match schema (invalid IPv4 part)", "data": "0:0:0:0:0:0:13.1.68.300", "valid": false }, { "description": "does not match schema (misplaced IPv4 part)", "data": "0:0:0:0:0:13.1.68.3:0", "valid": false }, { "description": "does not match schema (too long with IPv4 part)", "data": "0:0:0:0:0:0:0:13.1.68.3", "valid": false } ] }, { "description": "format uri", "schema": { "type": "string", "format": "uri" }, "tests": [ { "description": "matches schema", "data": "http://www.google.com/", "valid": true }, { "description": "matches schema (mixed case)", "data": "HtTp://WwW.GoOgLe.CoM/", "valid": true }, { "description": "matches schema (IPv4 literal)", "data": "http://10.11.12.13/foo/bar", "valid": true }, { "description": "matches schema (IPv6 literal)", "data": "http://[FEDC:BA98:7654:3210:FEDC:BA98:7654:3210]:80/index.html", "valid": true }, { "description": "matches schema (ISBN URN)", "data": "urn:isbn:0-486-27557-4", "valid": true }, { "description": "matches schema (authority)", "data": "ftp://user:pass@host/some/file", "valid": true }, { "description": "matches schema (query and fragment)", "data": "https://example.com/foo?q=abc%7E#frag", "valid": true }, { "description": "matches schema (file path)", "data": "file:///etc/passwd", "valid": true }, { "description": "matches schema (unusual but valid scheme)", "data": "weird-scheme-:is-weird", "valid": true }, { "description": "matches schema (relative URL)", "data": "myfile.json", "valid": true }, { "description": "matches schema (fragment only)", "data": "#myfragment", "valid": true } ] } ]