-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generated Go code for YAML Kind schemas.
Signed-off-by: Rule Timothy (VM/EMT3) <Timothy.Rule@de.bosch.com>
- Loading branch information
1 parent
b2c2102
commit 57dc9ed
Showing
15 changed files
with
1,043 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# Copyright 2024 Robert Bosch GmbH | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
|
||
KIND_YAML_DIR = ../../../schemas/yaml | ||
KIND_YAML_FILES = $(shell ls $(KIND_YAML_DIR)/*.yaml) | ||
|
||
|
||
.PHONY: generate | ||
generate: kind | ||
|
||
kind: $(KIND_YAML_FILES) | ||
|
||
.PHONY: $(KIND_YAML_FILES) | ||
$(KIND_YAML_FILES): | ||
@echo $$(basename $@) | ||
@mkdir -p kind | ||
@~/go/bin/oapi-codegen -config config.yaml $@ > kind/$$(basename $@).go | ||
@sed -i '/delete_this_line/d' kind/$$(basename $@).go | ||
@sed -i '/\/\//d' kind/$$(basename $@).go | ||
@sed -i '/./!d' kind/$$(basename $@).go | ||
@sed -i -e 's/externalRef[[:digit:]]*\.//g' kind/$$(basename $@).go | ||
@sed -i -e 's/`json:"/`yaml:"/g' kind/$$(basename $@).go | ||
@go fmt kind/$$(basename $@).go | ||
|
||
.PHONY: clean | ||
clean: | ||
@rm -rf kind |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package: kind | ||
generate: | ||
models: true | ||
import-mapping: | ||
metadata.yaml: delete_this_line | ||
channel.yaml: delete_this_line |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
module github.com/boschglobal/dse.schemas/code/go/dse | ||
|
||
go 1.21.6 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
ManifestKindManifest ManifestKind = "Manifest" | ||
) | ||
const ( | ||
Redispubsub SimulationParametersTransport = "redispubsub" | ||
) | ||
|
||
type File struct { | ||
Generate *string `yaml:"generate,omitempty"` | ||
Modelc *bool `yaml:"modelc,omitempty"` | ||
Name string `yaml:"name"` | ||
Processing *string `yaml:"processing,omitempty"` | ||
Repo *string `yaml:"repo,omitempty"` | ||
Uri *string `yaml:"uri,omitempty"` | ||
} | ||
type Manifest struct { | ||
Kind ManifestKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec ManifestSpec `yaml:"spec"` | ||
} | ||
type ManifestKind string | ||
type ManifestSpec struct { | ||
Documentation *[]File `yaml:"documentation,omitempty"` | ||
Models []Model `yaml:"models"` | ||
Repos []Repo `yaml:"repos"` | ||
Simulations []Simulation `yaml:"simulations"` | ||
Tools []Tool `yaml:"tools"` | ||
} | ||
type Model struct { | ||
Arch *string `yaml:"arch,omitempty"` | ||
Channels *[]Channel `yaml:"channels,omitempty"` | ||
Name string `yaml:"name"` | ||
Repo string `yaml:"repo"` | ||
Schema *string `yaml:"schema,omitempty"` | ||
Version string `yaml:"version"` | ||
} | ||
type ModelInstance struct { | ||
Channels []Channel `yaml:"channels"` | ||
Files *[]File `yaml:"files,omitempty"` | ||
Model string `yaml:"model"` | ||
Name string `yaml:"name"` | ||
} | ||
type Repo struct { | ||
Name string `yaml:"name"` | ||
Path *string `yaml:"path,omitempty"` | ||
Registry *string `yaml:"registry,omitempty"` | ||
Repo *string `yaml:"repo,omitempty"` | ||
Token string `yaml:"token"` | ||
User string `yaml:"user"` | ||
} | ||
type Simulation struct { | ||
Files *[]File `yaml:"files,omitempty"` | ||
Models []ModelInstance `yaml:"models"` | ||
Name string `yaml:"name"` | ||
Parameters *struct { | ||
Environment *map[string]string `yaml:"environment,omitempty"` | ||
Transport SimulationParametersTransport `yaml:"transport"` | ||
} `yaml:"parameters,omitempty"` | ||
} | ||
type SimulationParametersTransport string | ||
type Tool struct { | ||
Arch *[]string `yaml:"arch,omitempty"` | ||
Name string `yaml:"name"` | ||
Repo *string `yaml:"repo,omitempty"` | ||
Schema *string `yaml:"schema,omitempty"` | ||
Version string `yaml:"version"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
ModelKindModel ModelKind = "Model" | ||
) | ||
|
||
type ExecutableSpec struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
Arch *string `yaml:"arch,omitempty"` | ||
Libs *[]string `yaml:"libs,omitempty"` | ||
Os *string `yaml:"os,omitempty"` | ||
} | ||
type GatewaySpec struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
} | ||
type LibrarySpec struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
Arch *string `yaml:"arch,omitempty"` | ||
Libs *[]string `yaml:"libs,omitempty"` | ||
Os *string `yaml:"os,omitempty"` | ||
Path string `yaml:"path"` | ||
Variant *string `yaml:"variant,omitempty"` | ||
} | ||
type Model struct { | ||
Kind ModelKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec ModelSpec `yaml:"spec"` | ||
} | ||
type ModelKind string | ||
type ModelSpec struct { | ||
Channels *[]Channel `yaml:"channels,omitempty"` | ||
Runtime *struct { | ||
Dynlib *[]LibrarySpec `yaml:"dynlib,omitempty"` | ||
Executable *[]ExecutableSpec `yaml:"executable,omitempty"` | ||
Gateway *GatewaySpec `yaml:"gateway,omitempty"` | ||
Mcl *[]LibrarySpec `yaml:"mcl,omitempty"` | ||
} `yaml:"runtime,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package kind | ||
|
||
import () | ||
|
||
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 *[]Signal `yaml:"signals,omitempty"` | ||
} | ||
type Network struct { | ||
Kind NetworkKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec NetworkSpec `yaml:"spec"` | ||
} | ||
type NetworkKind string | ||
type NetworkSpec struct { | ||
Messages []Message `yaml:"messages"` | ||
} | ||
type Signal struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
Signal string `yaml:"signal"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
ParameterSetKindParameterSet ParameterSetKind = "ParameterSet" | ||
) | ||
|
||
type Parameter struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
Parameter string `yaml:"parameter"` | ||
Value *string `yaml:"value,omitempty"` | ||
} | ||
type ParameterSet struct { | ||
Kind ParameterSetKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec ParameterSetSpec `yaml:"spec"` | ||
} | ||
type ParameterSetKind string | ||
type ParameterSetSpec struct { | ||
Parameters []Parameter `yaml:"parameters"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
PropagatorKindPropagator PropagatorKind = "Propagator" | ||
) | ||
const ( | ||
Both PropagatorSpecOptionsDirection = "both" | ||
Forward PropagatorSpecOptionsDirection = "forward" | ||
Reverse PropagatorSpecOptionsDirection = "reverse" | ||
) | ||
|
||
type Propagator struct { | ||
Kind PropagatorKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec PropagatorSpec `yaml:"spec"` | ||
} | ||
type PropagatorKind string | ||
type PropagatorSpec struct { | ||
Options *struct { | ||
Direction *PropagatorSpecOptionsDirection `yaml:"direction,omitempty"` | ||
} `yaml:"options,omitempty"` | ||
Signals *[]SignalEncoding `yaml:"signals,omitempty"` | ||
} | ||
type PropagatorSpecOptionsDirection string | ||
type SignalEncoding struct { | ||
Encoding *struct { | ||
Linear *struct { | ||
Factor *float32 `yaml:"factor,omitempty"` | ||
Max *float32 `yaml:"max,omitempty"` | ||
Min *float32 `yaml:"min,omitempty"` | ||
Offset *float32 `yaml:"offset,omitempty"` | ||
} `yaml:"linear,omitempty"` | ||
Mapping *[]struct { | ||
Name *string `yaml:"name,omitempty"` | ||
Range *struct { | ||
Max *float32 `yaml:"max,omitempty"` | ||
Min *float32 `yaml:"min,omitempty"` | ||
} `yaml:"range,omitempty"` | ||
Source *float32 `yaml:"source,omitempty"` | ||
Target *float32 `yaml:"target,omitempty"` | ||
} `yaml:"mapping,omitempty"` | ||
} `yaml:"encoding,omitempty"` | ||
Signal string `yaml:"signal"` | ||
Target *string `yaml:"target,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
RunnableKindRunnable RunnableKind = "Runnable" | ||
) | ||
|
||
type Runnable struct { | ||
Kind RunnableKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec RunnableSpec `yaml:"spec"` | ||
} | ||
type RunnableKind string | ||
type RunnableSpec struct { | ||
Tasks []Task `yaml:"tasks"` | ||
} | ||
type Task struct { | ||
Function string `yaml:"function"` | ||
Schedule int `yaml:"schedule"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package kind | ||
|
||
import () | ||
|
||
const ( | ||
SignalGroupKindSignalGroup SignalGroupKind = "SignalGroup" | ||
) | ||
|
||
type Signal struct { | ||
Annotations *Annotations `yaml:"annotations,omitempty"` | ||
Signal string `yaml:"signal"` | ||
} | ||
type SignalGroup struct { | ||
Kind SignalGroupKind `yaml:"kind"` | ||
Metadata *ObjectMetadata `yaml:"metadata,omitempty"` | ||
Spec SignalGroupSpec `yaml:"spec"` | ||
} | ||
type SignalGroupKind string | ||
type SignalGroupSpec struct { | ||
Signals []Signal `yaml:"signals"` | ||
} |
Oops, something went wrong.