Skip to content

Commit f8df3b1

Browse files
authored
feat(mcp): add OAuth fields (#432)
- [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! - [ ] Any accompanying changes in `semgrep-proprietary` are approved and ready to merge once this PR is merged
1 parent 88691c9 commit f8df3b1

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

semgrep_metrics.atd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,10 @@ type mcp = {
299299
?fps <ocaml mutable>: (string (* rule_id *) * finding) list <json repr="object"> option;
300300
?num_skips <ocaml mutable>: int option;
301301
?skips <ocaml mutable>: (string (* rule_id *) * finding) list <json repr="object"> option;
302+
(* NEW: since OAuth *)
303+
?oauth_id <ocaml mutable>: string option;
304+
?oauth_name <ocaml mutable>: string option;
305+
?oauth_email <ocaml mutable>: string option;
302306
}
303307

304308
(*****************************************************************************)

semgrep_metrics.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -949,6 +949,9 @@ class Mcp:
949949
fps: Optional[List[Tuple[str, Finding]]] = None
950950
num_skips: Optional[int] = None
951951
skips: Optional[List[Tuple[str, Finding]]] = None
952+
oauth_id: Optional[str] = None
953+
oauth_name: Optional[str] = None
954+
oauth_email: Optional[str] = None
952955

953956
@classmethod
954957
def from_json(cls, x: Any) -> 'Mcp':
@@ -973,6 +976,9 @@ def from_json(cls, x: Any) -> 'Mcp':
973976
fps=_atd_read_assoc_object_into_list(Finding.from_json)(x['fps']) if 'fps' in x else None,
974977
num_skips=_atd_read_int(x['num_skips']) if 'num_skips' in x else None,
975978
skips=_atd_read_assoc_object_into_list(Finding.from_json)(x['skips']) if 'skips' in x else None,
979+
oauth_id=_atd_read_string(x['oauth_id']) if 'oauth_id' in x else None,
980+
oauth_name=_atd_read_string(x['oauth_name']) if 'oauth_name' in x else None,
981+
oauth_email=_atd_read_string(x['oauth_email']) if 'oauth_email' in x else None,
976982
)
977983
else:
978984
_atd_bad_json('Mcp', x)
@@ -1017,6 +1023,12 @@ def to_json(self) -> Any:
10171023
res['num_skips'] = _atd_write_int(self.num_skips)
10181024
if self.skips is not None:
10191025
res['skips'] = _atd_write_assoc_list_to_object((lambda x: x.to_json()))(self.skips)
1026+
if self.oauth_id is not None:
1027+
res['oauth_id'] = _atd_write_string(self.oauth_id)
1028+
if self.oauth_name is not None:
1029+
res['oauth_name'] = _atd_write_string(self.oauth_name)
1030+
if self.oauth_email is not None:
1031+
res['oauth_email'] = _atd_write_string(self.oauth_email)
10201032
return res
10211033

10221034
@classmethod

0 commit comments

Comments
 (0)