Skip to content

Commit

Permalink
Extend Signal schema to include new Transform object.
Browse files Browse the repository at this point in the history
Signed-off-by: Rule Timothy (VM/EMT3) <[email protected]>
  • Loading branch information
timrulebosch committed May 8, 2024
1 parent cefb457 commit 1d93153
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 1 deletion.
1 change: 1 addition & 0 deletions code/go/dse/kind/SignalGroup.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
type Signal struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Signal string `yaml:"signal"`
Transform *Transform `yaml:"transform,omitempty"`
}
type SignalGroup struct {
Kind SignalGroupKind `yaml:"kind"`
Expand Down
3 changes: 2 additions & 1 deletion code/go/dse/kind/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package: kind
generate:
models: true
import-mapping:
metadata.yaml: delete_this_line
channel.yaml: delete_this_line
metadata.yaml: delete_this_line
transform.yaml: delete_this_line
8 changes: 8 additions & 0 deletions code/go/dse/kind/transform.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package kind

type Transform struct {
Linear *struct {
Factor float64 `yaml:"factor"`
Offset float64 `yaml:"offset"`
} `yaml:"linear,omitempty"`
}
16 changes: 16 additions & 0 deletions doc/content/schemas/yaml/SignalGroup.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ metadata:
spec:
signals:
- signal: string
transform:
linear:
factor: 0
offset: 0
annotations:
? property1
? property2
Expand Down Expand Up @@ -62,6 +66,10 @@ A signal group definition.
```yaml
signals:
- signal: string
transform:
linear:
factor: 0
offset: 0
annotations:
? property1
? property2
Expand All @@ -83,6 +91,10 @@ signals:

```yaml
signal: string
transform:
linear:
factor: 0
offset: 0
annotations:
? property1
? property2
Expand All @@ -96,6 +108,10 @@ A signal definition.
|Name|Type|Required|Description|
|---|---|---|---|
|signal|string|true|The name of the signal.|
|transform|object|false|A transformation definition.|
|» linear|object|false|Represents a linear transformation in the form:<br> f(X) = X * factor + offset.|
|»» factor|number(double)|true|none|
|»» offset|number(double)|true|none|
|annotations|object|false|Non identifying information (i.e. information specific to the object itself).|
|» **additionalProperties**|any|false|none|
Expand Down
2 changes: 2 additions & 0 deletions schemas/yaml/SignalGroup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,7 @@ components:
signal:
type: string
description: The name of the signal.
transform:
$ref: 'transform.yaml#/components/schemas/Transform'
annotations:
$ref: 'metadata.yaml#/components/schemas/Annotations'
41 changes: 41 additions & 0 deletions schemas/yaml/transform.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Copyright 2024 Robert Bosch GmbH
#
# SPDX-License-Identifier: Apache-2.0

---
openapi: 3.0.0
info:
title: Transform
paths:
/Transform:
get:
responses:
'200':
description: ''
content:
text/yaml:
schema:
type: array
items:
$ref: '#/components/schemas/Transform'
components:
schemas:
Transform:
type: object
description: A transformation definition.
properties:
linear:
type: object
description: >
Represents a linear transformation in the form:
f(X) = X * factor + offset.
required:
- factor
- offset
properties:
factor:
type: number
format: double
offset:
type: number
format: double

0 comments on commit 1d93153

Please sign in to comment.