@wmfs/cardscript-schema

1.35.0 • Public • Published

cardscript-schema

Tymly Cardscript CircleCI npm (scoped) codecov CodeFactor Dependabot badge Commitizen friendly JavaScript Style Guide license

Contains a JSON Schema for Cardscript, along with a validation utility.

Install

$ npm install cardscript-schema --save

Usage

const cardscriptSchema = require('@wmfs/cardscript-schema')

const result = cardscriptSchema.validateForm(
  {
    "type": "AdaptiveCard",
    "body": [
      {
        "type": "TextBlock",
        "text": "Change me!",
        "color": "attention",
        "horizontalAlignment": "center"
      }
    ],
    "$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
    "version": "1.0"
  }
)

if (result.elementsValid) {
  // All is well!!
} else {
  // Do something with result.errors array.
}

Testing

$ npm test

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @wmfs/cardscript-schema

Weekly Downloads

111

Version

1.35.0

License

MIT

Unpacked Size

129 kB

Total Files

20

Last publish

Collaborators

  • wmfsbot