Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Protobuf use static uid #344

Merged
merged 3 commits into from
May 14, 2024
Merged

Conversation

eriksven
Copy link
Contributor

@eriksven eriksven commented Apr 4, 2024

This PR extends the protobuf generator to use the static-uid which would be created in a previous step with vspec2id generator. The PR also adds the feature to make all fields in the generated protobuf file to optional.

Using the static-uids has some drawbacks but the previously existing approach of using incremental field identifiers has some issue regarding backwards compatibility. Because of that I want to propose the alternative solution of using the static-uids. More details on the advantages and drawbacks of both approaches are available in the new vspec2proto.md Documentation.

@erikbosch
Copy link
Collaborator

MoM:

  • Please Review

## Example

```bash
./vspec2protobuf.py outputIds_v2.vspec indentity.proto -q ../vehicle_signal_specification/spec/quantities.yaml -u ../vehicle_signal_specification/spec/units.yaml --static-uid --add-optional
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you also get warnings like:

WARNING Attribute(s) staticUID in element Major not a core or known extended attribute.

In https://github.com/COVESA/vss-tools/blob/master/docs/vspec2id.md#generate-eg-yaml-file-with-static-uids they include -e staticUID in examples to avoid warnings

I am thinking if we promote staticUID to a core_attributes so that you never get a warning. Thoughts @adobekan

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I do get these warnings too. I thought this would be "normal" since staticUID is not a core_attributes. So thanks for the hint of how to avoid the warnings. I will have a look into it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Short term I think you could just add -e staticUID in the example. But I am thinking of the long term solution where I see multiple alternatives:

  • Promote staticUID as an allowed/core attribute for all tools always
  • Add it in some way as core-attribute for the specific tool, regardless of whether --static-uid is used or not
  • Add it only if --static-uid is used

For the last two alternatives we should find a common mechanism that can reused by all tools. I anyway not see it as a topic for this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation now contains an example with the parameter -e staticUID.

@adobekan
Copy link
Collaborator

@eriksven
I'm not sure if directly comparing static IDs with field numbers at the end makes sense. If we're using static IDs, the message description would likely be different. Additionally, I'm uncertain if we should describe any aspect of VSS in that area.

@erikbosch
Copy link
Collaborator

MoM:

  • Please review, possible merge decision next week

eriksven added 2 commits May 3, 2024 14:39
Signed-off-by: Sven Erik Jeroschewski <svenerik.jeroschewski@bosch.com>
Signed-off-by: Sven Erik Jeroschewski <svenerik.jeroschewski@bosch.com>
@eriksven eriksven force-pushed the protobuf-use-static-uid branch from 286218f to 09864f4 Compare May 3, 2024 12:44
…not have staticUID attribute

Signed-off-by: Sven Erik Jeroschewski <svenerik.jeroschewski@bosch.com>
@erikbosch
Copy link
Collaborator

@adobekan @eriksven - do you intend to participate in the meeting tomorrow (Tuesday 7th)? I think it would be good to agree on if we see any problems with this PR. My view is that this an option that does not affect default behavior, so if someone thinks this is a useful addition it is ok for me

@eriksven
Copy link
Contributor Author

eriksven commented May 7, 2024

@adobekan @eriksven - do you intend to participate in the meeting tomorrow (Tuesday 7th)? I think it would be good to agree on if we see any problems with this PR. My view is that this an option that does not affect default behavior, so if someone thinks this is a useful addition it is ok for me

Unfortunately, I am not able to join the meeting today. But I could join one of the next meetings.

@erikbosch
Copy link
Collaborator

erikbosch commented May 7, 2024

MoM:

  • Adnan - If I would use static id I would not this approach, it would be more useful if one would use generic message. Would be good to have SvenErik available for a discussion.
  • Erik: Could be useful if server use 4.2, client 4.1
  • Adnan: But then we could use a thin API (id+value), no need for fat API, but both approach valid, but we need to document both options.
  • Erik: Possibly discuss next week
  • Gunnar: Could it help if @eriksven describe intention with change better
  • Erik: discuss next week if this one needs to be part of 4.2

@erikbosch
Copy link
Collaborator

MoM:

  • SvenErik presented a bit on the background, using staticuid gives an opportunity to generate messages
  • Erik: Do not really see any blockers, it is optional, could be useful in some scenarios
  • Merge

@erikbosch erikbosch merged commit 109b3ed into COVESA:master May 14, 2024
5 checks passed
erikbosch pushed a commit that referenced this pull request May 17, 2024
* adds option to make fields optional in protobuf generator
* adds Documentation for proto generator
* makes vss2proto fail when running with staticUID flag but found does not have staticUID attribute

Signed-off-by: Sven Erik Jeroschewski <svenerik.jeroschewski@bosch.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants