Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions website/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 18 additions & 0 deletions website/versioned_docs/version-0.21/model-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ Below are examples of API use.

## Validating JSON data using a Model

To run the validation code below, you will need a Node.js environment.

**Step-by-step setup:**
1. Ensure you have [Node.js](https://nodejs.org/) installed.
2. Create a new folder, open it in a code editor like [VS Code](https://code.visualstudio.com/), and open a new terminal.
3. Initialize a new Node.js project and install the Concerto core component:
```bash
npm init -y
npm install @accordproject/concerto-core
```
4. Create a new file named `validate.js` and paste the following code into it:

```js
const ModelManager = require('@accordproject/concerto-core').ModelManager;
const Concerto = require('@accordproject/concerto-core').Concerto;
Expand All @@ -37,6 +49,12 @@ const concerto = new Concerto(modelManager);
concerto.validate(postalAddress);
```

5. Run the script from the terminal:
```bash
node validate.js
```
*If everything is correct, nothing will be printed to the console, meaning validation succeeded.*

Now try validating this instance:

```
Expand Down
18 changes: 18 additions & 0 deletions website/versioned_docs/version-0.30.0/model-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,18 @@ Below are examples of API use.

## Validating JSON data using a Model

To run the validation code below, you will need a Node.js environment.

**Step-by-step setup:**
1. Ensure you have [Node.js](https://nodejs.org/) installed.
2. Create a new folder, open it in a code editor like [VS Code](https://code.visualstudio.com/), and open a new terminal.
3. Initialize a new Node.js project and install the Concerto core component:
```bash
npm init -y
npm install @accordproject/concerto-core
```
4. Create a new file named `validate.js` and paste the following code into it:

```js
const ModelManager = require('@accordproject/concerto-core').ModelManager;
const Concerto = require('@accordproject/concerto-core').Concerto;
Expand All @@ -37,6 +49,12 @@ const concerto = new Concerto(modelManager);
concerto.validate(postalAddress);
```

5. Run the script from the terminal:
```bash
node validate.js
```
*If everything is correct, nothing will be printed to the console, meaning validation succeeded.*

Now try validating this instance:

```
Expand Down