Skip to content

Commit

Permalink
feat: add predicates to controller and application schemas (#146)
Browse files Browse the repository at this point in the history
  • Loading branch information
domire8 authored Apr 19, 2024
1 parent 5f6fecc commit b1a8faa
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 14 deletions.
4 changes: 2 additions & 2 deletions docs/docs/reference/02-yaml-syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ my_button:

## Validating a YAML application

The [YAML application schema](https://docs.aica.tech/schemas/1-3-0/application.schema.json) defines the structural rules
The [YAML application schema](https://docs.aica.tech/schemas/1-4-0/application.schema.json) defines the structural rules
of an AICA application and effectively distinguishes between valid and invalid syntax.

Many modern IDEs and code editors can be configured to support custom schemas and provide in-line validation and
Expand All @@ -928,5 +928,5 @@ Developers working with Visual Studio Code can validate YAML application files e
2. Associate a schema with the YAML application by adding the following modeline to the file:

```yaml
# yaml-language-server: $schema=https://docs.aica.tech/schemas/1-3-0/application.schema.json
# yaml-language-server: $schema=https://docs.aica.tech/schemas/1-4-0/application.schema.json
```
5 changes: 5 additions & 0 deletions schemas/applications/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@

Release Versions:

- [1-4-0](#140)
- [1-3-0](#130)
- [1-2-0](#120)
- [1-1-2](#112)
- [1-1-1](#111)
- [1-1-0](#110)
- [1-0-0](#100)

## 1-4-0

Version 1-4-0 adds support for predicate events on controllers.

## 1-3-0

Version 1-3-0 adds support for service calls on controllers.
Expand Down
2 changes: 1 addition & 1 deletion schemas/applications/schema/application.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "/1-3-0/application.schema.json",
"$id": "/1-4-0/application.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "YAML Application Description",
"description": "An AICA application graph description using YAML syntax.",
Expand Down
4 changes: 2 additions & 2 deletions schemas/applications/schema/components.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
}
},
"events": {
"title": "Event Predicates",
"title": "Component Event Predicates",
"description": "Component predicates that trigger events",
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -118,7 +118,7 @@
},
"patternProperties": {
"^[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]$": {
"title": "Predicate Events",
"title": "Component Predicate",
"description": "A component-specific predicate",
"$ref": "events.schema.json"
}
Expand Down
14 changes: 13 additions & 1 deletion schemas/applications/schema/hardware.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,19 @@
},
"outputs": {
"$ref": "common/outputs.schema.json"
}
},
"events": {
"title": "Controller Event Predicates",
"description": "Controller predicates that trigger events",
"type": "object",
"additionalProperties": false,
"patternProperties": {
"^[a-zA-Z][a-zA-Z0-9_]*[a-zA-Z0-9]$": {
"title": "Controller Predicate",
"description": "A controller-specific predicate",
"$ref": "events.schema.json"
}
}
},
"required": [
"plugin"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"description": "The predicates provided by the component.",
"type": "array",
"items": {
"$ref": "predicate.schema.json"
"$ref": "https://raw.githubusercontent.com/aica-technology/api/main/schemas/predicates/schema/predicate.schema.json"
},
"uniqueItems": true
},
Expand Down
9 changes: 9 additions & 0 deletions schemas/controller-descriptions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,19 @@

Release Versions:

- [1-3-0](#130)
- [1-2-0](#120)
- [1-1-0](#110)
- [1-0-0](#100)

## 1-3-0

As of version 1-2-0, controllers can also have the field `predicates` to list the predicates provided by the controller.

### Changelog

- feat(controller-schema): add predicates (#145)

## 1-2-0

As of version 1-2-0, controllers can also have the field `services` to list the services provided by the controller.
Expand Down
11 changes: 10 additions & 1 deletion schemas/controller-descriptions/schema/controller.schema.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "/1-2-0/controller.schema.json",
"$id": "/1-3-0/controller.schema.json",
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "AICA Controller Description",
"description": "A full description of a controller in the AICA application framework.",
Expand Down Expand Up @@ -106,6 +106,15 @@
},
"uniqueItems": true
},
"predicates": {
"title": "Controller Predicates",
"description": "The predicates provided by the controller.",
"type": "array",
"items": {
"$ref": "https://raw.githubusercontent.com/aica-technology/api/main/schemas/predicates/schema/predicate.schema.json"
},
"uniqueItems": true
},
"services": {
"title": "Controller Services",
"description": "The services provided by the controller.",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Component Predicate",
"description": "A predicate signal parameter of a dynamic component.",
"title": "Predicate",
"description": "A predicate of a component or controller.",
"type": "object",
"properties": {
"display_name": {
Expand All @@ -13,7 +13,7 @@
"type": "string"
},
"predicate_name": {
"description": "The lower_snake_case predicate name as it is declared in the component.",
"description": "The lower_snake_case predicate name as it is declared in the component or controller.",
"type": "string"
}
},
Expand Down
6 changes: 3 additions & 3 deletions schemas/services/schema/service.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "Component Service",
"description": "A service endpoint of a dynamic component.",
"title": "Service",
"description": "A service endpoint of a component or controller.",
"type": "object",
"properties": {
"display_name": {
Expand All @@ -13,7 +13,7 @@
"type": "string"
},
"service_name": {
"description": "The lower_snake_case service name as it is declared in the component.",
"description": "The lower_snake_case service name as it is declared in the component or controller.",
"type": "string"
},
"payload_format": {
Expand Down

0 comments on commit b1a8faa

Please sign in to comment.