|
| 1 | +## Tools |
| 2 | + |
| 3 | +This `tools/` folder does contain a few tools/scripts that help us to develop the papiNet API standard. |
| 4 | + |
| 5 | +### `analyse-uom.js` |
| 6 | + |
| 7 | +This script will list all the `uom` (unit of measure) within the schemas of the papiNet API OpenAPI documentation. |
| 8 | + |
| 9 | +```text |
| 10 | +node analyse-uom.js |
| 11 | +``` |
| 12 | + |
| 13 | +### `validate.cmd` |
| 14 | + |
| 15 | +This script will validate all the instances within the `..\3.0.0\mock\` folder against their respective schemas from the papiNet API OpenAPI documentation. |
| 16 | + |
| 17 | +This script is using the `yq` and `ajv` commands. The `ajv` command is using [Node.js](https://nodejs.org/en). |
| 18 | + |
| 19 | +```text |
| 20 | +validate.cmd |
| 21 | +``` |
| 22 | + |
| 23 | +#### How to install `yq` on Windows without administrative rights |
| 24 | + |
| 25 | +1\. Download the latest version of the binary `yq_windows_amd64.zip` at <https://github.com/mikefarah/yq/releases/latest> |
| 26 | + |
| 27 | +2\. Create a new subfolder `yq` within the folder `C:\Users\{Username}\AppData\Local\Programs`. |
| 28 | + |
| 29 | +3\. Unzip the file `yq_windows_amd64.exe` from the `yq_windows_amd64.zip` archive into the folder `C:\Users\{Username}\AppData\Local\Programs\yq` and rename it to `yq.exe`. |
| 30 | + |
| 31 | +4\. From a Windows Command Prompt run the following command: |
| 32 | + |
| 33 | +```text |
| 34 | +rundll32.exe sysdm.cpl,EditEnvironmentVariables |
| 35 | +``` |
| 36 | + |
| 37 | +5\. From the "User variables for {Username}" section, click on the "New..." button to create a new variable with the name `YQ_BIN` and the value `C:\Users\{Username}\AppData\Local\Programs\yq`. |
| 38 | + |
| 39 | +6\. From the "User variables for {Username}" section, select the `Path` variable and click on the "Edit.." button, then click on the "New" button and add the line `%YQ_BIN%` at the end. |
| 40 | + |
| 41 | +7\. From a **new** Windows Command Prompt run the following command to verify the installation: |
| 42 | + |
| 43 | +```text |
| 44 | +yq --version |
| 45 | +``` |
| 46 | + |
| 47 | +#### How to install Node.js on Windows without administrative rights |
| 48 | + |
| 49 | +1\. Download the latest version at <https://nodejs.org/en/download>; Click on the "Standalone Binary (.zip)" button while having selected "Windows" as _operating system_ and "x64" as _architecture_. |
| 50 | + |
| 51 | +2\. 3\. Unzip the folder `node-v22.12.0-win-x64` from `node-v22.12.0-win-x64.zip` archive into the folder `C:\Users\{Username}\AppData\Local\Programs`. |
| 52 | + |
| 53 | +3\. From a Windows Command Prompt run the following command: |
| 54 | + |
| 55 | +```text |
| 56 | +rundll32.exe sysdm.cpl,EditEnvironmentVariables |
| 57 | +``` |
| 58 | + |
| 59 | +4\. From the "User variables for {Username}" section, click on the "New..." button to create a new variable with the name `NODE_BIN` and the value `C:\Users\{Username}\AppData\Local\Programs\node-v22.12.0-win-x64`. |
| 60 | + |
| 61 | +5\. From the "User variables for {Username}" section, select the `Path` variable and click on the "Edit.." button, then click on the "New" button and add the line `%NODE_BIN%` at the end. |
| 62 | + |
| 63 | +6\. From a **new** Windows Command Prompt run the following command to verify the installation: |
| 64 | + |
| 65 | +```text |
| 66 | +node --version |
| 67 | +``` |
| 68 | + |
| 69 | +```text |
| 70 | +npm --version |
| 71 | +``` |
| 72 | + |
| 73 | +#### How to install `ajv` on Windows (without administrative rights) |
| 74 | + |
| 75 | +```text |
| 76 | +npm install -g ajv-cli |
| 77 | +``` |
| 78 | + |
| 79 | +```text |
| 80 | +npm install -g ajv-formats |
| 81 | +``` |
| 82 | + |
| 83 | +### `check-instances-with-markdown-and-pact.py` (work in progress) |
| 84 | + |
| 85 | +This Python script analyzes if the instances within the `..\3.0.0\mock\` folder are used within the use case file `..\3.0.0\paper-board-pulp-warehouse-logistics.md` and the Pact file `..\3.0.0\papiNet.PACT.json`. |
| 86 | + |
| 87 | +```text |
| 88 | +python check-instances-with-markdown-and-pact.py |
| 89 | +``` |
| 90 | + |
| 91 | +You can install Python without administrative rights using the Python Windows Installer available at <https://www.python.org/downloads/>. |
0 commit comments