Skip to content

Commit 1de5ce7

Browse files
aryxchmccreery
andauthored
Make project_metadata mandatory in scan_request (try 2) (#324)
try2 of #316 Step1 towards getting rid of meta. test plan: see related PR in semgrep-pro - [x] I ran `make setup && make` to update the generated code after editing a `.atd` file (TODO: have a CI check) - [x] I made sure we're still backward compatible with old versions of the CLI. For example, the Semgrep backend need to still be able to *consume* data generated by Semgrep 1.50.0. See https://atd.readthedocs.io/en/latest/atdgen-tutorial.html#smooth-protocol-upgrades Note that the types related to the semgrep-core JSON output or the semgrep-core RPC do not need to be backward compatible! --------- Co-authored-by: Clara McCreery <[email protected]>
1 parent 37314fd commit 1de5ce7

7 files changed

+92
-207
lines changed

semgrep_output_v1.atd

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ type skipped_rule = {
833833
(* coupling: with semgrep_metrics.atd performance section *)
834834

835835
(* coupling: if you change the JSON schema below, you probably need to
836-
* also modify perf/run-benchmarks. Run locally $ ./run-benchmarks --dummy --upload
836+
* also modify perf/run-benchmarks.
837+
* Run locally $ ./run-benchmarks --dummy --upload
837838
*)
838839
type profile = {
839840
(* List of rules, including the one read but not run on any target.
@@ -1359,12 +1360,18 @@ type scan_metadata = {
13591360

13601361
(* Sent by the CLI to the POST /api/cli/scans to create a scan. *)
13611362
type scan_request = {
1362-
(* until 1.43ish, was 'meta: project_metadata;' before *)
1363-
meta: raw_json;
1364-
(* from 1.43 *)
1365-
?project_metadata: project_metadata option; (* replacing meta *)
1363+
(* added in 1.43 as options, and mandatory since 1.100.0 (replacing meta) *)
1364+
project_metadata: project_metadata;
1365+
scan_metadata: scan_metadata;
1366+
1367+
(* added in 1.43 *)
13661368
?project_config: ci_config_from_repo option;
1367-
?scan_metadata: scan_metadata option;
1369+
1370+
(* deprecated: moved as an option in 1.100.0 and was duplicative of
1371+
* information in project_metadata and scan_metadata since 1.43.0
1372+
* old: 'meta: project_metadata;' before 1.43
1373+
*)
1374+
?meta: raw_json option;
13681375
}
13691376

13701377
(* Response from the backend to the CLI to the POST /api/cli/scans *)
@@ -1942,7 +1949,6 @@ type apply_fixes_return <python decorator="dataclass(frozen=True)"> = {
19421949
fixed_lines: (int * string list) list;
19431950
}
19441951

1945-
(* The parameters here pretty much match what's needed by Sarif_output.sarif_output. *)
19461952
type sarif_format_params <python decorator="dataclass(frozen=True)"> = {
19471953
hide_nudge: bool;
19481954
engine_label: string;

semgrep_output_v1.jsonschema

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.proto

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.py

Lines changed: 10 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

semgrep_output_v1.ts

Lines changed: 9 additions & 9 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)