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
19 changes: 10 additions & 9 deletions .github/actions/bundle-schema/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,24 @@ runs:
echo "prev_schema_id=${PREV_SCHEMA_ID}" >> $GITHUB_OUTPUT
shell: bash
- uses: actions/checkout@v3
# Bundle JSON schema
- uses: actions/setup-node@v3
- uses: actions/cache@v4
with:
node-version: "18"
cache: "npm"
cache-dependency-path: "utils/package-lock.json"
path: ~/.bun/install/cache
key: ${{ runner.os }}-bun-${{ hashFiles('schemas/bun.lock') }}
restore-keys: |
${{ runner.os }}-bun-
- uses: oven-sh/setup-bun@v2
with:
bun-version: "1.3"
- name: Install dependencies
shell: bash
run: |
cd utils
npm ci
pip3 install javascript
bun ci --cwd schemas
- name: Bundle & Push schemas
if: ${{ steps.versions.outputs.new_schema_id != steps.versions.outputs.prev_schema_id }}
shell: bash
run: |
node utils/bundleHelper.js ${{ inputs.schema-path }} ${{ inputs.schema }}
bun run --cwd schemas bundle ${{ inputs.schema-path }} ${{ inputs.schema }}
EXPORT_DIR="docs/static/schemas/${{ steps.versions.outputs.new_schema_version }}"
echo "Ensuring directory branch name: ${EXPORT_DIR}"
mkdir -p "${EXPORT_DIR}"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/bundle-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ jobs:
matrix:
include:
- schema: application
schema-path: ./schemas/applications/schema
schema-path: ./applications/schema
- schema: component
schema-path: ./schemas/component-descriptions/schema
schema-path: ./component-descriptions/schema
- schema: controller
schema-path: ./schemas/controller-descriptions/schema
schema-path: ./controller-descriptions/schema
- schema: extension
schema-path: ./schemas/extensions/schema
schema-path: ./extensions/schema
- schema: interfaces
schema-path: ./schemas/interfaces/schema
schema-path: ./interfaces/schema
name: Bundle the ${{ matrix.schema }} schema
steps:
- name: Check out repository code
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.idea
.DS_Store
*/node_modules
30 changes: 6 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

This repository contains tools and resources for interacting with the AICA API, applications and components.

## Documentation

The documentation is available at https://docs.aica.tech/.

The source and contribution guidelines are available in the [docs](./docs) subdirectory.

## Python client

The Python client is available at https://pypi.org/project/aica-api/ and can be installed as follows:
Expand All @@ -16,27 +22,3 @@ See the [python](./python) subdirectory for more information and source code.

JSON schemas defining the expected syntax for AICA application files or component descriptions are available
in the [schemas](./schemas) subdirectory.

### Bundling the schemas locally

In order to bundle the schemas locally for debugging and testing, do the following (replace `SCHEMA_NAME` and
`SCHEMA_PATH` with the appropriate values for other schemas):

```bash
SCHEMA_NAME="interfaces"
SCHEMA_PATH="schemas/interfaces/schema"
docker build -t aica-technology/api-schema -f- . <<EOF
FROM node:latest
WORKDIR /tmp
COPY . .
RUN cd utils && npm install
RUN node utils/bundleHelper.js "${SCHEMA_PATH}"/"${SCHEMA_NAME}".schema.json "${SCHEMA_NAME}"
EOF
if [ $? -eq 0 ]; then \
CONTAINER_ID=$(docker run -d aica-technology/api-schema);
docker cp "${CONTAINER_ID}":/tmp/"${SCHEMA_NAME}".schema.json .;
docker cp "${CONTAINER_ID}":/tmp/"${SCHEMA_NAME}".types.schema.json .;
docker stop "${CONTAINER_ID}";
docker rm "${CONTAINER_ID}";
fi
```
38 changes: 38 additions & 0 deletions schemas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,48 @@ of AICA component classes.
The [controller-descriptions](./controller-descriptions) directory defines the JSON syntax for describing the properties
of AICA controller plugins.

## Extensions

The [extensions](./extensions) unifies the previous description schemas for components and controllers.

## Interfaces

The [interfaces](./interfaces) directory defines a schema with common interface definitions used by both
the component and controller descriptions.

## Bundling the schemas

In order to bundle the schemas for debugging and testing, do the following (replace `SCHEMA_NAME` and `SCHEMA_PATH`
with the appropriate values for other schemas):

```bash
SCHEMA_NAME="interfaces"
SCHEMA_PATH="interfaces/schema"
bun install
bun run bundleHelper.js "${SCHEMA_PATH}"/"${SCHEMA_NAME}".schema.json "${SCHEMA_NAME}"
```

or, with Docker:

```bash
SCHEMA_NAME="interfaces"
SCHEMA_PATH="interfaces/schema"
docker build -t aica-technology/api-schema -f- . <<EOF
FROM oven/bun:1.3
WORKDIR /tmp
COPY . .
RUN bun install
RUN bun run bundleHelper.js "${SCHEMA_PATH}"/"${SCHEMA_NAME}".schema.json "${SCHEMA_NAME}"
EOF
if [ $? -eq 0 ]; then \
CONTAINER_ID=$(docker run -d aica-technology/api-schema);
docker cp "${CONTAINER_ID}":/tmp/"${SCHEMA_NAME}".schema.json .;
docker cp "${CONTAINER_ID}":/tmp/"${SCHEMA_NAME}".types.schema.json .;
docker stop "${CONTAINER_ID}";
docker rm "${CONTAINER_ID}";
fi
```

## Tools

The Dockerfile and bash scripts can be used to easily view or validate JSON schemas.
Expand All @@ -41,4 +78,5 @@ Available `schema_collection` options are:
- `applications`
- `component-descriptions`
- `controller-descriptions`
- `extensions`
- `interfaces`
28 changes: 28 additions & 0 deletions schemas/bun.lock

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

File renamed without changes.
11 changes: 11 additions & 0 deletions schemas/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "schemas",
"version": "0.0.0",
"private": true,
"scripts": {
"bundle": "bun run bundleHelper.js"
},
"dependencies": {
"@apidevtools/json-schema-ref-parser": "^11.1.0"
}
}
2 changes: 0 additions & 2 deletions utils/.gitignore

This file was deleted.

74 changes: 0 additions & 74 deletions utils/package-lock.json

This file was deleted.

7 changes: 0 additions & 7 deletions utils/package.json

This file was deleted.