Skip to content

refactor!: Pass SarifAnalysis by value#4394

Merged
gmlewis merged 3 commits into
google:masterfrom
JamBalaya56562:refactor/3644-sarif-analysis-value-params
Jul 17, 2026
Merged

refactor!: Pass SarifAnalysis by value#4394
gmlewis merged 3 commits into
google:masterfrom
JamBalaya56562:refactor/3644-sarif-analysis-value-params

Conversation

@JamBalaya56562

@JamBalaya56562 JamBalaya56562 commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

BREAKING CHANGE: CodeScanningService.UploadSarif now takes body by value and its required fields are no longer pointers.

Towards #3644.

This has two commits:

  1. refactor!CodeScanning.UploadSarif now takes its SarifAnalysis body by value instead of by pointer, and the three required properties become non-pointer strings (their omitempty is dropped). The OpenAPI schema for POST /repos/{owner}/{repo}/code-scanning/sarifs lists commit_sha, ref, and sarif as required, so SarifAnalysis.CommitSHA, .Ref, and .Sarif are now string. SarifAnalysis is removed from the paramcheck body-allowed-pointer-types allowlist in .golangci.yml.

  2. feat — adds the optional Validate *bool (validate) property, which the same endpoint accepts but SarifAnalysis was missing.

SarifAnalysis is the dedicated body of that single endpoint (the response is a separate SarifID), so there is no shared-type / split concern. The generated accessors are regenerated.

Towards google#3644.

BREAKING CHANGE: CodeScanning.UploadSarif now takes SarifAnalysis by value, and SarifAnalysis.CommitSHA, .Ref, and .Sarif are now non-pointer strings.
The upload-an-analysis-as-SARIF-data endpoint accepts an optional validate
property that was missing from SarifAnalysis.
@gmlewis gmlewis added NeedsReview PR is awaiting a review before merging. Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s). labels Jul 16, 2026
Comment thread github/code_scanning.go Outdated
@gmlewis gmlewis removed the NeedsReview PR is awaiting a review before merging. label Jul 17, 2026
@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.51%. Comparing base (bf1261b) to head (7b0f7e7).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #4394   +/-   ##
=======================================
  Coverage   97.51%   97.51%           
=======================================
  Files         193      193           
  Lines       19526    19526           
=======================================
  Hits        19040    19040           
  Misses        268      268           
  Partials      218      218           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@gmlewis
gmlewis merged commit 8d7ad2d into google:master Jul 17, 2026
15 checks passed
@JamBalaya56562
JamBalaya56562 deleted the refactor/3644-sarif-analysis-value-params branch July 17, 2026 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Breaking API Change PR will require a bump to the major version num in next release. Look here to see the change(s).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants