@@ -1934,6 +1934,43 @@ def to_json_string(self, **kw: Any) -> str:
1934
1934
return json .dumps (self .to_json (), ** kw )
1935
1935
1936
1936
1937
+ @dataclass
1938
+ class FindingHashes :
1939
+ """Original type: finding_hashes = { ... }"""
1940
+
1941
+ start_line_hash : str
1942
+ end_line_hash : str
1943
+ code_hash : str
1944
+ pattern_hash : str
1945
+
1946
+ @classmethod
1947
+ def from_json (cls , x : Any ) -> 'FindingHashes' :
1948
+ if isinstance (x , dict ):
1949
+ return cls (
1950
+ start_line_hash = _atd_read_string (x ['start_line_hash' ]) if 'start_line_hash' in x else _atd_missing_json_field ('FindingHashes' , 'start_line_hash' ),
1951
+ end_line_hash = _atd_read_string (x ['end_line_hash' ]) if 'end_line_hash' in x else _atd_missing_json_field ('FindingHashes' , 'end_line_hash' ),
1952
+ code_hash = _atd_read_string (x ['code_hash' ]) if 'code_hash' in x else _atd_missing_json_field ('FindingHashes' , 'code_hash' ),
1953
+ pattern_hash = _atd_read_string (x ['pattern_hash' ]) if 'pattern_hash' in x else _atd_missing_json_field ('FindingHashes' , 'pattern_hash' ),
1954
+ )
1955
+ else :
1956
+ _atd_bad_json ('FindingHashes' , x )
1957
+
1958
+ def to_json (self ) -> Any :
1959
+ res : Dict [str , Any ] = {}
1960
+ res ['start_line_hash' ] = _atd_write_string (self .start_line_hash )
1961
+ res ['end_line_hash' ] = _atd_write_string (self .end_line_hash )
1962
+ res ['code_hash' ] = _atd_write_string (self .code_hash )
1963
+ res ['pattern_hash' ] = _atd_write_string (self .pattern_hash )
1964
+ return res
1965
+
1966
+ @classmethod
1967
+ def from_json_string (cls , x : str ) -> 'FindingHashes' :
1968
+ return cls .from_json (json .loads (x ))
1969
+
1970
+ def to_json_string (self , ** kw : Any ) -> str :
1971
+ return json .dumps (self .to_json (), ** kw )
1972
+
1973
+
1937
1974
@dataclass (frozen = True )
1938
1975
class CliMatchDataflowTrace :
1939
1976
"""Original type: cli_match_dataflow_trace = { ... }"""
@@ -1989,6 +2026,7 @@ class Finding:
1989
2026
metadata : RawJson
1990
2027
is_blocking : bool
1991
2028
match_based_id : Optional [str ] = None
2029
+ hashes : Optional [FindingHashes ] = None
1992
2030
fixed_lines : Optional [List [str ]] = None
1993
2031
sca_info : Optional [ScaInfo ] = None
1994
2032
dataflow_trace : Optional [CliMatchDataflowTrace ] = None
@@ -2011,6 +2049,7 @@ def from_json(cls, x: Any) -> 'Finding':
2011
2049
metadata = RawJson .from_json (x ['metadata' ]) if 'metadata' in x else _atd_missing_json_field ('Finding' , 'metadata' ),
2012
2050
is_blocking = _atd_read_bool (x ['is_blocking' ]) if 'is_blocking' in x else _atd_missing_json_field ('Finding' , 'is_blocking' ),
2013
2051
match_based_id = _atd_read_string (x ['match_based_id' ]) if 'match_based_id' in x else None ,
2052
+ hashes = FindingHashes .from_json (x ['hashes' ]) if 'hashes' in x else None ,
2014
2053
fixed_lines = _atd_read_list (_atd_read_string )(x ['fixed_lines' ]) if 'fixed_lines' in x else None ,
2015
2054
sca_info = ScaInfo .from_json (x ['sca_info' ]) if 'sca_info' in x else None ,
2016
2055
dataflow_trace = CliMatchDataflowTrace .from_json (x ['dataflow_trace' ]) if 'dataflow_trace' in x else None ,
@@ -2035,6 +2074,8 @@ def to_json(self) -> Any:
2035
2074
res ['is_blocking' ] = _atd_write_bool (self .is_blocking )
2036
2075
if self .match_based_id is not None :
2037
2076
res ['match_based_id' ] = _atd_write_string (self .match_based_id )
2077
+ if self .hashes is not None :
2078
+ res ['hashes' ] = (lambda x : x .to_json ())(self .hashes )
2038
2079
if self .fixed_lines is not None :
2039
2080
res ['fixed_lines' ] = _atd_write_list (_atd_write_string )(self .fixed_lines )
2040
2081
if self .sca_info is not None :
0 commit comments