MCPcopy Index your code
hub / github.com/eclipse-thingweb/playground

github.com/eclipse-thingweb/playground @TD1.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release TD1.0 ↗ · + Follow
140 symbols 288 edges 59 files 105 documented · 75% updated 4d agoTD-11-CR · 2023-02-07★ 3327 open issues
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Web of Things (W3C) - Thing Description Playground

Try it online at http://plugfest.thingweb.io/playground/

GitHub license GitHub testing

Installation

There are different ways to use Playground:

  • Install all packages and their dependencies via npm install in the root directory. This script calls lerna bootstrap.
  • You can install the different packages from npm (see below) or in their respective directories.

Structure

The structure of all Web of Things (WoT) Playground packages is shown here: packageStructure
The core package provides a function to check whether a Thing Description (TD) is valid according to the W3C WoT standard. Its functionality can be imported, as well as the assertion checks of the assertion package. They create a report stating how much standard assertions a fulfilled by a single TD or WoT Implementation. Both packages are used by the Web and CLI packages to provide their functionalities, plus IO functionalities through an UI.

Packages

The packages in this repository (here), which you find on NPM under @thing-description-playground/packageName.

  • You can use the assertion package to integrate assertion testing via an API in your own packages. The assertions package can be found here or on NPM.
  • You can use the cli package to test one/multiple TDs via the command line or execute assertion testing with it. The cli for the playground can be found here or on NPM.
  • You can use the core package as an API to validate TDs in your own packages. The core package can be found here or on NPM.
  • You can use the defaults package to add/remove explicitly stated default values in a TD. The default package can be found here or on NPM.
  • You can use the gist_backend package to host a backend for the gist-submission functionality of the browser version of the playground. The package can be found here or on NPM.
  • You can use the td_to_openAPI package to create an openAPI instance from a Thing Description. The package can be found here or on NPM.
  • You can use the web package to host/adapt your own browser version of the WoT playground. The web package can be found here or on NPM.

Examples

Examples are included in the core and can be used in the web interface by a dropdown menu.

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
  • If you loose your internet connection when validating JSON-LD validation will fail since it tries to access the documents under @context (can be turned off)

  • Offline/OnPremise: by hosting the web yourself. Therefore, please deliver the "index.html" file with a web-server.

Batch Testing

Please have a look at the cli package for batch testing of Thing Descriptions.

Script based Assertion Tester

Please have a look at the cli package for script based assertion testing, or at the assertions package, if you're planning to integrate the assertion testing as a dependency in your own NPM modules.

Script based Thing Description Validation

Please have look at the cli package for script based TD validation, or at the core package, if you're planning to integrate the TD validation as a dependency in your own NPM modules.

License

All packages are licensed under the MIT license. You find a copy of the License here.

Publish a new version

  1. Run lerna bootstrap to install dependencies among the packages, even if a package has never been published before. Make sure you have not increased the dependency versions yet, e.g., you have a new package newExample and the oldExample depends on it. The newExample is on version 0.0.0 (since you want to publish it as 1.0.0) then in the oldExample package.json the dependency has to be on the same version (or lower) so "dependencies" { newExample: "^0.0.0"}}. Otherwise lerna will not accept linking the local newExample.
  2. If lerna bootstrap was successful you can now bump dependency versions (if required), e.g., you could now do "dependencies" { newExample: "^1.0.0"}} in the oldExample package.json.
  3. Run lerna publish to publish all new package versions. Lerna will then ask for every changed package whether it received a patch, minor or major update. In our example you should now select major for the newExample so that it will be published as 1.0.0 version. You should login to npm via npm login before doing this.

Core symbols most depended-on inside this repo

removeDefaults
called by 20
packages/defaults/index.js
addDefaults
called by 19
packages/defaults/index.js
tdValidator
called by 15
packages/core/index.js
genChannels
called by 8
packages/td_to_asyncapi/src/genChannels.js
forEvery
called by 8
packages/defaults/src/util.js
isStringObjectKeyValue
called by 8
packages/core/shared.js
customShot
called by 8
packages/web/test.js
genInfo
called by 6
packages/td_to_asyncapi/src/genRoot.js

Shape

Function 140

Languages

TypeScript100%

Modules by API surface

packages/web/util.js23 symbols
packages/cli/index.js12 symbols
packages/td_to_asyncapi/src/definitions.js9 symbols
packages/core/shared.js8 symbols
packages/web/test.js7 symbols
packages/td_to_openAPI/mapSecurity.js7 symbols
packages/defaults/index.js7 symbols
packages/core/index.js7 symbols
packages/td_to_openAPI/genInteraction.js6 symbols
packages/td_to_openAPI/crawlPaths.js5 symbols
packages/assertions/assertionTests.js5 symbols
packages/assertions/index.js4 symbols

For agents

$ claude mcp add playground \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact