Skip to content

Commit

Permalink
Extend AST Simulation schema to support File specification.
Browse files Browse the repository at this point in the history
Signed-off-by: Timothy Rule (VM/EMT3) <Timothy.Rule@de.bosch.com>
  • Loading branch information
timrulebosch committed Feb 24, 2025
1 parent 21c53a2 commit d565802
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 9 deletions.
11 changes: 10 additions & 1 deletion code/go/dse/ast/Simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,27 @@ package ast

import ()

const (
FileReferenceUses FileReference = "uses"
)
const (
SimulationKindSimulation SimulationKind = "Simulation"
)
const (
VarReferenceUses VarReference = "uses"
)

type File struct {
Name string `yaml:"name"`
Reference *FileReference `yaml:"reference,omitempty"`
Value string `yaml:"value"`
}
type FileReference string
type Model struct {
Arch *string `yaml:"arch,omitempty"`
Channels []ModelChannel `yaml:"channels"`
Env *[]Var `yaml:"env,omitempty"`
Files *[]string `yaml:"files,omitempty"`
Files *[]File `yaml:"files,omitempty"`
Metadata *map[string]interface{} `yaml:"metadata,omitempty"`
Model string `yaml:"model"`
Name string `yaml:"name"`
Expand Down
46 changes: 41 additions & 5 deletions doc/content/schemas/yaml/Simulation.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,9 @@ stacks:
- name: string
alias: string
files:
- string
- name: string
value: string
reference: uses
env:
- name: string
value: string
Expand Down Expand Up @@ -276,6 +278,36 @@ A variable definition.
|---|---|
|reference|uses|
<h2 id="tocS_File">File</h2>
<a id="schemafile"></a>
<a id="schema_File"></a>
<a id="tocSfile"></a>
<a id="tocsfile"></a>
```yaml
name: string
value: string
reference: uses

```
A file definition.
### Properties
|Name|Type|Required|Description|
|---|---|---|---|
|name|string|true|Name of the file (to be placed in the data folder of a model) or a relative path of the file (i.e. relative to the Model defining the file).|
|value|string|true|A corresponding file value, interpret as a 'uses' reference or a local file path.|
|reference|string|false|This value is derived from the specified reference (e.g. a downloaded file) The resource name is specified in the value.|
#### Enumerated Values
|Property|Value|
|---|---|
|reference|uses|
<h2 id="tocS_Stack">Stack</h2>
<a id="schemastack"></a>
Expand Down Expand Up @@ -303,7 +335,9 @@ models:
- name: string
alias: string
files:
- string
- name: string
value: string
reference: uses
env:
- name: string
value: string
Expand Down Expand Up @@ -349,7 +383,9 @@ channels:
- name: string
alias: string
files:
- string
- name: string
value: string
reference: uses
env:
- name: string
value: string
Expand All @@ -375,7 +411,7 @@ workflows:
|» **additionalProperties**|any|false|none|
|arch|string|false|The architecture of the model, if different from the stack or simulation default architecture.|
|channels|[[ModelChannel](#schemamodelchannel)]|true|An array of model <-> simulation channel mappings.|
|files|[string]|false|An array of file paths which should be combined with the model deployment.|
|files|[[File](#schemafile)]|false|An array of files to be combined with the model deployment. Files specified without a path are placed<br>in the model data folder (i.e. 'sim/<model>/data'), otherwise the file is placed relative to the<br>model folder.|
|env|[[Var](#schemavar)]|false|Sets environment variables in the runtime of this model.<br>Values defined here supersede those set in the simulation stack (of the model).|
|workflows|[[Workflow](#schemaworkflow)]|false|An array of workflows used to construct/process artifacts used by this model instance.|

Expand All @@ -402,7 +438,7 @@ vars:
|---|---|---|---|
|name|string|true|The name of the workflow.|
|uses|string|false|If a workflow is located in a different repository than the model, indicate that here.|
|vars|[[Var](#schemavar)]|false|Set variable values to be used by the workflow.|
|vars|[[Var](#schemavar)]|false|Set variable values to be used by the workflow.|

undefined

27 changes: 24 additions & 3 deletions schemas/yaml/Simulation.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,24 @@ components:
description: This value is derived from the specified reference (e.g. a downloaded file) The resource name is specified in the value.
enum:
- uses
File:
type: object
description: A file definition.
required:
- name
- value
properties:
name:
type: string
description: Name of the file (to be placed in the data folder of a model) or a relative path of the file (i.e. relative to the Model defining the file).
value:
type: string
description: A corresponding file value, interpret as a 'uses' reference or a local file path.
reference:
type: string
description: This value is derived from the specified reference (e.g. a downloaded file) The resource name is specified in the value.
enum:
- uses
Stack:
type: object
description: A stack definition which composes one or more models as a logical unit of the simulation.
Expand Down Expand Up @@ -252,9 +270,12 @@ components:
$ref: '#/components/schemas/ModelChannel'
files:
type: array
description: An array of file paths which should be combined with the model deployment.
description: |
An array of files to be combined with the model deployment. Files specified without a path are placed
in the model data folder (i.e. 'sim/<model>/data'), otherwise the file is placed relative to the
model folder.
items:
type: string
$ref: '#/components/schemas/File'
env:
type: array
description: |
Expand All @@ -281,6 +302,6 @@ components:
vars:
type: array
description: |
Set variable values to be used by the workflow.
Set variable values to be used by the workflow.
items:
$ref: '#/components/schemas/Var'

0 comments on commit d565802

Please sign in to comment.