Skip to content

Conversation

@nikpivkin
Copy link
Contributor

Description

This PR refactors the handling of IaC values in the iac/types package. A new generic BaseValue structure is introduced, serving as a universal container for storing a value along with its metadata. It centralizes all core logic for working with values, including JSON serialization and Rego conversion.

Typed values (StringValue, BoolValue, TimeValue, etc.) remain and can override behavior, for example TimeValue.ToRego, as well as provide domain-specific methods like StringValue.StartsWith or StringValue.Contains.

Constructors are preserved for convenient and safe creation of values, while invariants such as Default, Explicit, and Unresolvable are centrally enforced through BaseValue.

Checklist

  • I've read the guidelines for contributing to this repository.
  • I've followed the conventions in the PR title.
  • I've added tests that prove my fix is effective or that my feature works.
  • I've updated the documentation with the relevant information (if needed).
  • I've added usage information (if the PR introduces new options)
  • I've included a "before" and "after" example to the description (if the PR is a user interface change).

… values

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
@nikpivkin nikpivkin added the autoready Automatically mark PR as ready for review when all checks pass label Dec 24, 2025
@github-actions github-actions bot added the apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected) label Dec 24, 2025
@github-actions
Copy link

📊 API Changes Detected

Semver impact: major

github.com/aquasecurity/trivy/pkg/iac/types
  Incompatible changes:
  - BaseAttribute: removed
  - BoolValue.BaseAttribute: removed
  - BytesValue.BaseAttribute: removed
  - IntFromInt32: removed
  - IntValue.BaseAttribute: removed
  - MapValue.BaseAttribute: removed
  - StringValue.BaseAttribute: removed
  - TimeValue.BaseAttribute: removed
  - TimeValue.Value: changed from func() time.Time to func() RFC3339Time
  Compatible changes:
  - BaseValue: added
  - BoolValue.BaseValue: added
  - BytesValue.BaseValue: added
  - IntValue.BaseValue: added
  - MapValue.BaseValue: added
  - RFC3339Time: added
  - StringValue.BaseValue: added
  - TimeValue.BaseValue: added

@aqua-bot aqua-bot requested a review from a team December 24, 2025 10:30
@github-actions github-actions bot marked this pull request as ready for review December 24, 2025 10:50
@github-actions github-actions bot removed the autoready Automatically mark PR as ready for review when all checks pass label Dec 24, 2025
@github-actions github-actions bot requested a review from simar7 as a code owner December 24, 2025 10:50
@nikpivkin nikpivkin removed the request for review from a team December 24, 2025 11:25
@nikpivkin nikpivkin removed the apidiff Indicates Go API changes relevant to library consumers (CLI compatibility may be unaffected) label Dec 24, 2025
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.

1 participant