Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Tom Hollingworth committed Oct 21, 2024
2 parents 973e3d8 + fb76e98 commit 96c008f
Show file tree
Hide file tree
Showing 60 changed files with 57,548 additions and 14 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
./Docs/static/schemas/*.json
/Docs/public/
.hugo_build.lock
Examples/
Examples/
node_modules/
.DS_Store
43 changes: 32 additions & 11 deletions .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,45 @@
stages:
- lint
- jsonschema-validator
- containerize
- deploy

lint:
stage: lint
image: golang:latest
jsonschema-validator:
stage: jsonschema-validator
image: node:latest
script:
- go install github.com/giantswarm/schemalint/v2@latest
- |
for i in ./Schema/*.json;
do echo "checking $i";
schemalint verify $i;
done
#!/bin/bash
# Install dependencies
npm install ajv@^8.0.0
# Path to your validation script
VALIDATOR_SCRIPT="scripts/compileSchemas.js"
# Check if the validation script exists
if [ ! -f "$VALIDATOR_SCRIPT" ]; then
echo "Validation script $VALIDATOR_SCRIPT not found."
exit 1
fi
# Run the validation script
node "$VALIDATOR_SCRIPT"
# Check exit status
if [ $? -eq 0 ]; then
echo "All schemas compiled successfully."
else
echo "There was an error compiling schemas."
exit 1
fi
containerize-localhost:
stage: containerize
image: docker:latest
needs:
- lint
- jsonschema-validator
variables:
HOST: "http://localhost/"
services:
Expand All @@ -40,7 +61,7 @@ containerize-jsonlibremfgai:
stage: containerize
image: docker:latest
needs:
- lint
- jsonschema-validator
variables:
HOST: "https://json.libremfg.ai/"
ENV_SLUG: "jsonlibremfgai"
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ ARG HOST=http://localhost/

# Copy in the schema files & replace JSON Schema Location
RUN mkdir ./Docs/static/schemas && \
cp ./Schema/* ./Docs/static/schemas/ && \
cp ./schemas/* ./Docs/static/schemas/ && \
sed -i 's,\("$id"\: *"\),\1'"$HOST"'schemas/,g' ./Docs/static/schemas/*.json && \
sed -i 's,\("$ref"\: *"\)\./,\1'"$HOST"'schemas/,g' ./Docs/static/schemas/*.json

Expand Down
2 changes: 1 addition & 1 deletion Docs/content/posts/version-v1.0.0.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
+++
title = 'Version v1.0.0'
title = 'Version 1.0.0'
date = 2024-07-12T18:43:31Z
+++

Expand Down
60 changes: 60 additions & 0 deletions Docs/content/posts/version-v2.0.0.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
+++
title = 'Version 2.0.0'
date = 2024-09-20T14:52:37-05:00
+++

> A JSON Schema implementation of the ANSI/ISA-95 and ANSI/ISA-88 standards.
An JSON implementation of the ANSI/ISA-95, Enterprise-Control System Integration, family of standards (ISA-95), known internationally as IEC/ISO 62264. B2MML consists of a set of JSON schemas written using the JSON Schema's Schema language (2020) that implement the data models in the ISA-95 standard.

This JSON schema can be used for design for syncrhonous and asynchronous APIs.

Based on the works of https://github.com/MESAInternational/B2MML-BatchML.

## Abbreviations

| Acronynm | Description |
|-------------|---------------------------------------------------------------|
| **ANSI** | American National Standards Institute |
| **API** | Application Programming Interface |
| **B2MML** | Business to (2) Manufacturing Markup Language |
| **BatchML** | Batch Markup Language |
| **BOD** | Business Object Document |
| **ISA** | International Society of Automation |
| **IEC** | International Electrotechnical Commission |
| **JSON** | JavaScipt Object Notation |
| **XML** | eXensible Markup Language |
| **XSD** | eXtensible markup language Schema Definition |

## Quick start

Start out by importing the schema and using it in your JSON documents.

```
"$schema": "{{< siteurl >}}schemas/"
```

Here is an example using the JSON schema in a `NotifyWorkDefined` message.

```json
{
"$schema": "{{< siteurl >}}schemas/",
"NotifyWorkDefined": {
"ApplicationArea": {},
"DataArea": {
"Notify": {},
"WorkDefined": {

}
}
}
}
```

## Updates Introduced in Version 2.0.0

Refactored the v1.0.0.base.schema.json JSON file by separating it into multiple files that use the prefix "v2.0.0", aligning the structure with the existing B2MMl XML implementation https://github.com/MESAInternational/B2MML-BatchML/tree/master/Schema.

Implemented several automated scripts to assist in refactoring. While these scripts are tailored for specific use cases, they can generally be disregarded outside of those particular scenarios.

In Version 2.0.0, a JSON Schema validator is used for verification, replacing the previous Lint-based approach. This update compiles and validates schemas through the use of scripts, specifically compileSchemas.js, located in scripts, and validate.mjs.
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module validator

go 1.22.2
Empty file added go.sum
Empty file.
75 changes: 75 additions & 0 deletions package-lock.json

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

7 changes: 7 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"dependencies": {
"ajv": "^8.17.1",
"ajv-formats": "^3.0.1"
},
"version": "0.0.0"
}
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 96c008f

Please sign in to comment.