-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PR for discussion - how to keep instance information
Signed-off-by: Erik Jaegervall <[email protected]>
- Loading branch information
Showing
7 changed files
with
14,079 additions
and
1 deletion.
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
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" | ||
] | ||
], | ||
``` |
Oops, something went wrong.