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

Use structpb.Value as internal storage of Property #4250

Merged
merged 1 commit into from
Aug 22, 2024

Conversation

jhrozek
Copy link
Contributor

@jhrozek jhrozek commented Aug 22, 2024

Summary

There are several reasons to use structpb.Value over any:

  • NewValue contains pretty nice code that can e.g. serialize a []byte slice base64 encoded
  • Returning the value as any actually does checks, for example for over/underflow for numerical values and returns a NaN in that case
  • there is another draft PR that proposes to use structpb.Struct in the general entity protobuf message which would make the value easily usable should we need to

Related: #4171

Change Type

  • Bug fix (resolves an issue without affecting existing features)
  • Feature (adds new functionality without breaking changes)
  • Breaking change (may impact existing functionalities or require documentation updates)
  • Documentation (updates or additions to documentation)
  • Refactoring or test improvements (no bug fixes or new functionality)

Testing

unit tests

Review Checklist:

  • Reviewed my own code for quality and clarity.
  • Added comments to complex or tricky code sections.
  • Updated any affected documentation.
  • Included tests that validate the fix or feature.
  • Checked that related changes are merged.

There are several reasons to use structpb.Value over `any`:
- NewValue contains pretty nice code that can e.g. serialize a []byte slice base64 encoded
- Returning the value as any actually does checks, for example for over/underflow for numerical values and returns a NaN in that case
- there is another draft PR that proposes to use structpb.Struct in the general entity protobuf message which would make the value easily usable should we need to

Related: mindersec#4171
@jhrozek jhrozek requested a review from a team as a code owner August 22, 2024 11:36
@coveralls
Copy link

Coverage Status

coverage: 53.724% (-0.04%) from 53.764%
when pulling b4b8bef on jhrozek:prop_proto_struct
into d32c80c on stacklok:main.

@jhrozek jhrozek merged commit b30ca2e into mindersec:main Aug 22, 2024
22 checks passed
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