Skip to content

Commit

Permalink
PR for discussion - how to keep instance information
Browse files Browse the repository at this point in the history
Signed-off-by: Erik Jaegervall <[email protected]>
  • Loading branch information
erikbosch committed Sep 6, 2023
1 parent b8c3362 commit cfd5e79
Show file tree
Hide file tree
Showing 7 changed files with 14,079 additions and 1 deletion.
48 changes: 48 additions & 0 deletions Expanded-info.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#PR for discussion

## Problem description

Today, if you use JSON generated from *.vspec information on whether a branch existed in *.vspec or comes from
instance expansion (e.g. DriverSide, PassengerSide) is lost. This makes it difficult if you want to handle instantiation
differently in your tool, i.e. you want a representation similar to what exist in *.vspec files.

This PR prototypes two methods, and is intended for discussion

## Alternative 1: Annotate that a branch is expanded

In this PR an example for JSOn is shown, running as today:

```
vss-tools/vspec2json.py -I ./spec --uuid -u ./spec/units.yaml --json-pretty ./spec/VehicleSignalSpecification.vspec expand.json
```

...gives an extra output `expanded:true` for branches that has been expanded.

I.e. branches like `Vehicle.Cabin.Seat.Row2.PassengerSide` will have `expanded:true`, while regular branches like
`Vehicle.Cabin` and `Vehicle.Cabin.Seat` will not have any `expanded` attribute.

## Alternative 1B: Keep original instance-information (not implemented)

Instead of `expanded:true` we could keep the original expansion information like below, or format it in some other way.
But that require a bit more work, as today the original expansion information is modfiied during expansion

## Alternative 2: Support a no-expand option.

Simply add a new param to skip expansion

```
vss-tools/vspec2json.py -I ./spec --uuid -u ./spec/units.yaml --json-pretty --no-expand ./spec/VehicleSignalSpecification.vspec no_expand.json
```

By adding some extra code we can preserve the expansion information:

```
"description": "Decorative coloured light inside the cabin, usually mounted on the door, ceiling, etc.",
"instances": [
"Row[1,2]",
[
"DriverSide",
"PassengerSide"
]
],
```
Loading

0 comments on commit cfd5e79

Please sign in to comment.