Skip to content

Commit

Permalink
Add additional documentation on data type exports (#295)
Browse files Browse the repository at this point in the history
Signed-off-by: Krishna Koppolu <[email protected]>
Co-authored-by: Krishna Koppolu <[email protected]>
  • Loading branch information
kkoppolu1 and Krishna Koppolu authored Jun 27, 2023
1 parent 528868a commit b8c3362
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 2 deletions.
39 changes: 38 additions & 1 deletion docs/vspec2x.md
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ The export format is similar to the export format of VSS signals. The below tabl

The YAML exporter maintains the file structure of the vspec file being exported.

**NOTE:** For YAML and JSON, if a separate output file is not provided, the complex data types are exported under the key - `ComplexDataTypes`. See the snippets below for illustration.

**CSV snippet**
```csv
"Node","Type","DataType","Deprecated","Unit","Min","Max","Desc","Comment","Allowed","Default"
Expand All @@ -115,7 +117,7 @@ The YAML exporter maintains the file structure of the vspec file being exported.
"<PropertyName>","property","<DataType>","<Deprecation>","<Unit>","<Min>","<Max>","<Description>","<Comment>","<Allowed values>","<Default Value>"
```

**JSON snippet**
**JSON snippet (data types are exported to a separate file)**
```json
{
"VehicleDataTypes": {
Expand Down Expand Up @@ -143,6 +145,41 @@ The YAML exporter maintains the file structure of the vspec file being exported.
}
```

**JSON snippet (signals and data types are exported to a single file)**
```json
{
"Vehicle": {
"type": "branch"
// Signal tree
},
"ComplexDataTypes": {
"VehicleDataTypes": {
// complex data type tree
"children": {
"<Branch>": {
"children": {
"<Struct>": {
"children": {
"<Property>": {
"type": "property",
"datatype": "<Data Type>",
"description": "<Description",
// ...
}
},
"description": "<Description>",
"type": "struct"
}
}
"description": "<Description>",
"type": "branch"
}
}
}
}
}
```

## Handling of units

The tooling verifies that only pre-defined units are used, like `kPa`and `percent`.
Expand Down
5 changes: 4 additions & 1 deletion vspec2x.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,10 @@ def main(arguments):
default=[],
help='Data types file in vspec format.')
type_group.add_argument('-ot', '--types-output-file', metavar='<types_output_file>',
help='Output file for writing data types from vspec file.')
help='Output file for writing data types from vspec file. ' +
'If not specified, a single file is used where applicable. ' +
'In case of JSON and YAML, the data is exported under a ' +
'special key - "ComplexDataTypes"')

for entry in Exporter:
entry.value.add_arguments(parser.add_argument_group(
Expand Down

0 comments on commit b8c3362

Please sign in to comment.