diff --git a/code/go/dse/kind/Network.go b/code/go/dse/kind/Network.go index 9e561c3..8853c3b 100644 --- a/code/go/dse/kind/Network.go +++ b/code/go/dse/kind/Network.go @@ -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"` } diff --git a/doc/content/schemas/yaml/Network.md b/doc/content/schemas/yaml/Network.md index d6d521a..3f96100 100644 --- a/doc/content/schemas/yaml/Network.md +++ b/doc/content/schemas/yaml/Network.md @@ -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.| -

Message

+

NetworkMessage

- - - - + + + + ```yaml message: systemStatus @@ -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.|

NetworkSignal

@@ -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).| -

Function

+

NetworkFunctions

- - - - + + + + + +```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.| + +

NetworkFunction

+ + + + + ```yaml function: crc_generate @@ -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 diff --git a/schemas/yaml/Network.yaml b/schemas/yaml/Network.yaml index cdec54c..59cf571 100644 --- a/schemas/yaml/Network.yaml +++ b/schemas/yaml/Network.yaml @@ -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. @@ -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: @@ -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.