Skip to content

Commit

Permalink
Make project_metadata mandatory in scan_request (try 2) (#324)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
aryx and chmccreery authored Dec 9, 2024
1 parent 37314fd commit 1de5ce7
Show file tree
Hide file tree
Showing 7 changed files with 92 additions and 207 deletions.
20 changes: 13 additions & 7 deletions semgrep_output_v1.atd
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,8 @@ type skipped_rule = {
(* coupling: with semgrep_metrics.atd performance section *)

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

(* Sent by the CLI to the POST /api/cli/scans to create a scan. *)
type scan_request = {
(* until 1.43ish, was 'meta: project_metadata;' before *)
meta: raw_json;
(* from 1.43 *)
?project_metadata: project_metadata option; (* replacing meta *)
(* added in 1.43 as options, and mandatory since 1.100.0 (replacing meta) *)
project_metadata: project_metadata;
scan_metadata: scan_metadata;

(* added in 1.43 *)
?project_config: ci_config_from_repo option;
?scan_metadata: scan_metadata option;

(* deprecated: moved as an option in 1.100.0 and was duplicative of
* information in project_metadata and scan_metadata since 1.43.0
* old: 'meta: project_metadata;' before 1.43
*)
?meta: raw_json option;
}

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

(* The parameters here pretty much match what's needed by Sarif_output.sarif_output. *)
type sarif_format_params <python decorator="dataclass(frozen=True)"> = {
hide_nudge: bool;
engine_label: string;
Expand Down
6 changes: 3 additions & 3 deletions semgrep_output_v1.jsonschema

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions semgrep_output_v1.proto

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 10 additions & 11 deletions semgrep_output_v1.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 9 additions & 9 deletions semgrep_output_v1.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1de5ce7

Please sign in to comment.