Giter VIP home page Giter VIP logo

thingweb-playground's Introduction

thingweb-playground

Validation tool for W3C WoT Thing Descriptions. Your Thing Descriptions should be written according to the W3C standard found here.

Limitations:

  • There is limited nested validation. This is due to the JSON Schema specification which doesn't allow infinite references with $ref keywords. Because of this an enum key in a e.g. #/actions/input/properties/enum will not be necessarily checked. More information can be found here.

There are different tools that can be found in this repo. They will be split later on.

Browser based Thing Description Validation

  • Online: It is hosted here

    • Simply paste a TD in the text field and click validate
    • Safari browser has unexpected behavior with JSON-LD documents
  • Offline: by opening thingweb-playground/WebContent/index.html in a Web Browser.

    • Simply paste a TD in the text field and click validate
    • Safari browser has unexpected behavior with JSON-LD documents

You can also use the this JSON editor to create a TD in a validated fashion.

Script based Thing Description Validation

This is a node.js based tool

* Go to Scripts folder and run `npm install`
* Run `node Scripts/playground.js "./WebContent/Examples/Bundang/Valid/MyLampThing.jsonld"` to validate a Thing Description found at `./WebContent/Examples/Bundang/Valid/MyLampThing.jsonld'. You can replace this with a TD you want to validate.

Script based Assertion Tester

This tool checks which assertions are satisfied by a given Thing Description. The assertions are modeled as JSON Schema. This means that there are only JSON Schema testable assertions are checked. 'AssertionTester/Assertions' has these assertions. To use it from the root directory of the repository:

  • Run 'node ./AssertionTester/assertionTester.js an_example_TD_location'. E.g. 'node ./AssertionTester/assertionTester.js WebContent/Examples/Lyon/Valid/JsonLdThing.jsonld'
  • The results are found in the 'AssertionTester/Results'
    • There will be a .csv and a .json file. .csv has the format required by the test results display format and the .json has the same data and also the error message.
    • The result can be pass, fail or not-impl

Examples

  • Some example Thing Descriptions are provided in the Examples folder at directory WebContent/Examples. There are :
    • Valid: 4 lights are lit green, no warning message is displayed
    • Warning: 4 lights are lit green, at least one warning message is displayed, starting with ! in the console
    • Invalid: At least one of the 4 lights are lit red.

For developers/contributors:

For complex schemas If valid then it is not implemented if error says not-impl then it is not implemented if error says impl then it is implemented If somehow error says fail then it is failed

Output is structured as follows:
[main assertion]:[sub assertion if exists]=[result]

For simple schemas

Batch Testing

For Linux:

  • Open a bash console in terminal
  • From the root directory of the playground, run ./batchTest.sh
    • This tests all the TDs in WebContent/Examples/
      • A TD in Valid directory should be valid
      • A TD in Invalid directory should be invalid, giving an error in at least one check
      • A TD in Warning directory should give at least one warning in a check but should be valid at the same time
  • In order to test batch TDs, put them in the WebContent/Examples/Valid directory.
  • You can change the folder where the valid, invalid and warning TDs should be located.

To-Do

  • Assertions:

td-string-type td-integer-type td-number-type td-property-names ? td-property-objects:properties td-property-objects:items ??? td-event-response-arrays td-security-overrides td-media-type STILL VALID? td-jsonld-preprocessing-context td-jsonld-preprocessing-prefix td-jsonld-preprocessing-defaults td-vocab-description td-vocab-name td-vocab-properties td-vocab-title td-vocab-readOnly td-vocab-enum td-vocab-const td-vocab-writeOnly td-vocab-oneOf td-vocab-unit td-vocab-maxItems td-vocab-items td-vocab-minItems td-vocab-minimum td-vocab-maximum td-vocab-required td-vocab-scheme td-vocab-proxy td-vocab-in td-vocab-qop td-vocab-authorization td-vocab-alg td-vocab-format td-vocab-identity td-vocab-refresh td-vocab-token td-vocab-flow client-data-schema client-uri-template

  • test cases:
    • scopes in interaction level
  • Scripting:
    • invalid args, such as integers or non valid paths
  • Needed Validation

thingweb-playground's People

Contributors

egekorkan avatar mmccool avatar vcharpenay avatar matthiaslaeufer avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.