Skip to content

Commit

Permalink
Update network schema.
Browse files Browse the repository at this point in the history
  • Loading branch information
timrulebosch committed Mar 25, 2024
1 parent ad4fe31 commit 64e9737
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 46 deletions.
29 changes: 15 additions & 14 deletions code/go/dse/kind/Network.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,30 @@ const (
NetworkKindNetwork NetworkKind = "Network"
)

type Function struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Function string `yaml:"function"`
}
type Message struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Functions *struct {
Decode *[]Function `yaml:"decode,omitempty"`
Encode *[]Function `yaml:"encode,omitempty"`
} `yaml:"functions,omitempty"`
Message string `yaml:"message"`
Signals *[]NetworkSignal `yaml:"signals,omitempty"`
}
type Network struct {
Kind NetworkKind `yaml:"kind"`
Metadata *ObjectMetadata `yaml:"metadata,omitempty"`
Spec NetworkSpec `yaml:"spec"`
}
type NetworkKind string
type NetworkFunction struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Function string `yaml:"function"`
}
type NetworkFunctions struct {
Decode *[]NetworkFunction `yaml:"decode,omitempty"`
Encode *[]NetworkFunction `yaml:"encode,omitempty"`
}
type NetworkMessage struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Functions *NetworkFunctions `yaml:"functions,omitempty"`
Message string `yaml:"message"`
Signals *[]NetworkSignal `yaml:"signals,omitempty"`
}
type NetworkSignal struct {
Annotations *Annotations `yaml:"annotations,omitempty"`
Signal string `yaml:"signal"`
}
type NetworkSpec struct {
Messages []Message `yaml:"messages"`
Messages []NetworkMessage `yaml:"messages"`
}
57 changes: 41 additions & 16 deletions doc/content/schemas/yaml/Network.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,14 +127,14 @@ messages:

|Name|Type|Required|Description|
|---|---|---|---|
|messages|[[Message](#schemamessage)]|true|A list of messages belonging to this Network.|
|messages|[[NetworkMessage](#schemanetworkmessage)]|true|A list of messages belonging to this Network.|

<h2 id="tocS_Message">Message</h2>
<h2 id="tocS_NetworkMessage">NetworkMessage</h2>

<a id="schemamessage"></a>
<a id="schema_Message"></a>
<a id="tocSmessage"></a>
<a id="tocsmessage"></a>
<a id="schemanetworkmessage"></a>
<a id="schema_NetworkMessage"></a>
<a id="tocSnetworkmessage"></a>
<a id="tocsnetworkmessage"></a>

```yaml
message: systemStatus
Expand Down Expand Up @@ -181,9 +181,7 @@ A Network message definition.
|annotations|object|false|Non identifying information (i.e. information specific to the object itself).|
|» **additionalProperties**|string|false|none|
|signals|[[NetworkSignal](#schemanetworksignal)]|false|A list of signals represented in this message.|
|functions|object|false|Message functions to be applied to this message.|
|» encode|[[Function](#schemafunction)]|false|Message functions applied to the encode processing path (i.e. from Signal to Network interface). Functions are implicitly applied in the order of definition.|
|» decode|[[Function](#schemafunction)]|false|Message functions applied to the decode processing path (i.e. from Network to Signal interface). Functions are implicitly applied in the order of definition.|
|functions|[NetworkFunctions](#schemanetworkfunctions)|false|Message functions to be applied to this message.|

<h2 id="tocS_NetworkSignal">NetworkSignal</h2>

Expand Down Expand Up @@ -216,14 +214,41 @@ A Network signal definition.
|Name|Type|Required|Description|
|---|---|---|---|
|signal|string|true|The name of the signal.|
|annotations|[Message/properties/annotations](#schemamessage/properties/annotations)|false|Non identifying information (i.e. information specific to the object itself).|
|annotations|[NetworkMessage/properties/annotations](#schemanetworkmessage/properties/annotations)|false|Non identifying information (i.e. information specific to the object itself).|

<h2 id="tocS_Function">Function</h2>
<h2 id="tocS_NetworkFunctions">NetworkFunctions</h2>

<a id="schemafunction"></a>
<a id="schema_Function"></a>
<a id="tocSfunction"></a>
<a id="tocsfunction"></a>
<a id="schemanetworkfunctions"></a>
<a id="schema_NetworkFunctions"></a>
<a id="tocSnetworkfunctions"></a>
<a id="tocsnetworkfunctions"></a>

```yaml
encode:
- &a1
function: crc_generate
annotations:
position: 0
decode:
- *a1

```

Message functions to be applied to this message.

### Properties

|Name|Type|Required|Description|
|---|---|---|---|
|encode|[[NetworkFunction](#schemanetworkfunction)]|false|Message functions applied to the encode processing path (i.e. from Signal to Network interface). Functions are implicitly applied in the order of definition.|
|decode|[[NetworkFunction](#schemanetworkfunction)]|false|Message functions applied to the decode processing path (i.e. from Network to Signal interface). Functions are implicitly applied in the order of definition.|

<h2 id="tocS_NetworkFunction">NetworkFunction</h2>

<a id="schemanetworkfunction"></a>
<a id="schema_NetworkFunction"></a>
<a id="tocSnetworkfunction"></a>
<a id="tocsnetworkfunction"></a>

```yaml
function: crc_generate
Expand All @@ -239,7 +264,7 @@ A Network Function definition.
|Name|Type|Required|Description|
|---|---|---|---|
|function|string|true|The name of the function (i.e. the name of the symbol _in_ the Network Function shared library).|
|annotations|[Message/properties/annotations](#schemamessage/properties/annotations)|false|Non identifying information (i.e. information specific to the object itself).|
|annotations|[NetworkMessage/properties/annotations](#schemanetworkmessage/properties/annotations)|false|Non identifying information (i.e. information specific to the object itself).|

undefined

34 changes: 18 additions & 16 deletions schemas/yaml/Network.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,8 @@ components:
type: array
description: A list of messages belonging to this Network.
items:
$ref: '#/components/schemas/Message'
Message:
$ref: '#/components/schemas/NetworkMessage'
NetworkMessage:
type: object
description: |
A Network message definition.
Expand Down Expand Up @@ -128,19 +128,7 @@ components:
items:
$ref: '#/components/schemas/NetworkSignal'
functions:
type: object
description: Message functions to be applied to this message.
properties:
encode:
type: array
description: Message functions applied to the encode processing path (i.e. from Signal to Network interface). Functions are implicitly applied in the order of definition.
items:
$ref: '#/components/schemas/Function'
decode:
type: array
description: Message functions applied to the decode processing path (i.e. from Network to Signal interface). Functions are implicitly applied in the order of definition.
items:
$ref: '#/components/schemas/Function'
$ref: '#/components/schemas/NetworkFunctions'
example:
message: systemStatus
annotations:
Expand Down Expand Up @@ -190,7 +178,21 @@ components:
struct_member_name: temperature
struct_member_offset: 2
struct_member_primitive_type: int16_t
Function:
NetworkFunctions:
type: object
description: Message functions to be applied to this message.
properties:
encode:
type: array
description: Message functions applied to the encode processing path (i.e. from Signal to Network interface). Functions are implicitly applied in the order of definition.
items:
$ref: '#/components/schemas/NetworkFunction'
decode:
type: array
description: Message functions applied to the decode processing path (i.e. from Network to Signal interface). Functions are implicitly applied in the order of definition.
items:
$ref: '#/components/schemas/NetworkFunction'
NetworkFunction:
type: object
description: |
A Network Function definition.
Expand Down

0 comments on commit 64e9737

Please sign in to comment.