Skip to content

Commit

Permalink
feat: add services to controller and application schemas (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
domire8 authored Apr 9, 2024
1 parent c99fc89 commit b9abacb
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 24 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-2-0/application.schema.json) defines the structural rules
The [YAML application schema](https://docs.aica.tech/schemas/1-3-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-2-0/application.schema.json
# yaml-language-server: $schema=https://docs.aica.tech/schemas/1-3-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,12 +2,17 @@

Release Versions:

- [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-3-0

Version 1-3-0 adds support for service calls on controllers.

## 1-2-0

Version 1-2-0 adds a new syntax to manage sequential events as an array of steps to be handled in order. Sequence steps
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-2-0/application.schema.json",
"$id": "/1-3-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
70 changes: 51 additions & 19 deletions schemas/applications/schema/events/call_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": "Call Service",
"description": "Call a service on a component",
"description": "Call a service",
"oneOf": [
{
"type": "array",
Expand All @@ -19,28 +19,60 @@
}
],
"$defs": {
"payload": {
"title": "Service Payload",
"description": "The payload of the service call, formatted according to the service description",
"type": [
"string",
"object"
]
},
"service_object": {
"title": "Service Object",
"type": "object",
"additionalProperties": false,
"properties": {
"service": {
"$ref": "identifiers/service.schema.json"
},
"component": {
"$ref": "identifiers/component.schema.json"
"title": "Call Service Object",
"oneOf": [
{
"title": "Call Component Service Object",
"type": "object",
"additionalProperties": false,
"properties": {
"service": {
"$ref": "identifiers/service.schema.json"
},
"payload": {
"$ref": "#/$defs/payload"
},
"component": {
"$ref": "identifiers/component.schema.json"
}
},
"required": [
"service"
]
},
"payload": {
"title": "Service Payload",
"description": "The payload of the service call, formatted according to the service description",
"type": [
"string",
"object"
{
"title": "Call Controller Service Object",
"type": "object",
"additionalProperties": false,
"properties": {
"service": {
"$ref": "identifiers/service.schema.json"
},
"hardware": {
"$ref": "identifiers/hardware.schema.json"
},
"controller": {
"$ref": "identifiers/controller.schema.json#/properties/controller"
},
"payload": {
"$ref": "#/$defs/payload"
}
},
"required": [
"service",
"hardware",
"controller"
]
}
},
"required": [
"service"
]
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
"description": "The services provided by the component.",
"type": "array",
"items": {
"$ref": "service.schema.json"
"$ref": "https://raw.githubusercontent.com/aica-technology/api/main/schemas/services/schema/service.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,9 +2,18 @@

Release Versions:

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

## 1-2-0

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

### Changelog

- feat(controller-schema): add services (#138)

## 1-1-0

Version 1-1-0 adds a new property `optional` to the parameter schema to indicate if the user needs to specify a value in
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-1-0/controller.schema.json",
"$id": "/1-2-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 @@ -105,6 +105,15 @@
"$ref": "https://raw.githubusercontent.com/aica-technology/api/main/schemas/parameters/schema/parameter.schema.json"
},
"uniqueItems": true
},
"services": {
"title": "Controller Services",
"description": "The services provided by the controller.",
"type": "array",
"items": {
"$ref": "https://raw.githubusercontent.com/aica-technology/api/main/schemas/services/schema/service.schema.json"
},
"uniqueItems": true
}
},
"required": [
Expand Down
File renamed without changes.

0 comments on commit b9abacb

Please sign in to comment.