Skip to content

Commit bf204d8

Browse files
authored
Merge pull request #160 from GitGuardian/kjayasekera/change-fields-to-string
chore(models): change certain fields to str
2 parents e2f0498 + e0d8566 commit bf204d8

File tree

2 files changed

+48
-26
lines changed

2 files changed

+48
-26
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!--
2+
A new scriv changelog fragment.
3+
4+
Uncomment the section that is right (remove the HTML comment wrapper).
5+
-->
6+
7+
<!--
8+
### Removed
9+
10+
- A bullet item for the Removed category.
11+
12+
-->
13+
<!--
14+
### Added
15+
16+
- A bullet item for the Added category.
17+
18+
-->
19+
20+
### Changed
21+
22+
- Changed the following fields to `str`: `visibility`, `kind`, `presence status`, `ignore_reason`, `tag`.
23+
24+
<!--
25+
### Deprecated
26+
27+
- A bullet item for the Deprecated category.
28+
29+
-->
30+
<!--
31+
### Fixed
32+
33+
- A bullet item for the Fixed category.
34+
35+
-->
36+
<!--
37+
### Security
38+
39+
- A bullet item for the Security category.
40+
41+
-->

pygitguardian/models.py

Lines changed: 7 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -903,25 +903,6 @@ class Detector(Base, FromDictMixin):
903903

904904
Severity = Literal["info", "low", "medium", "high", "critical", "unknown"]
905905
ValidityStatus = Literal["valid", "invalid", "failed_to_check", "no_checker", "unknown"]
906-
IncidentStatus = Literal["IGNORED", "TRIGGERED", "RESOLVED", "ASSIGNED"]
907-
Tag = Literal[
908-
"DEFAULT_BRANCH",
909-
"FROM_HISTORICAL_SCAN",
910-
"CHECK_RUN_SKIP_FALSE_POSITIVE",
911-
"CHECK_RUN_SKIP_LOW_RISK",
912-
"CHECK_RUN_SKIP_TEST_CRED",
913-
"IGNORED_IN_CHECK_RUN",
914-
"FALSE_POSITIVE",
915-
"PUBLICLY_EXPOSED",
916-
"PUBLICLY_LEAKED",
917-
"REGRESSION",
918-
"SENSITIVE_FILE",
919-
"TEST_FILE",
920-
]
921-
IgnoreReason = Literal["test_credential", "false_positive", "low_risk"]
922-
OccurrenceKind = Literal["realtime", "historical"]
923-
OccurrencePresence = Literal["present", "removed"]
924-
Visibility = Literal["private", "internal", "public"]
925906

926907

927908
@dataclass
@@ -1003,7 +984,7 @@ class Source(FromDictWithBase):
1003984
open_incidents_count: int
1004985
closed_incidents_count: int
1005986
secret_incidents_breakdown: SecretIncidentsBreakdown
1006-
visibility: Visibility
987+
visibility: str
1007988
external_id: str
1008989
source_criticality: SourceCriticality
1009990
last_scan: Optional[Scan]
@@ -1044,7 +1025,7 @@ class OccurrenceMatch(Base, FromDictMixin):
10441025
class SecretOccurrence(Base, FromDictMixin):
10451026
id: int
10461027
incident_id: int
1047-
kind: OccurrenceKind
1028+
kind: str
10481029
source: Source
10491030
author_name: str
10501031
author_info: str
@@ -1053,7 +1034,7 @@ class SecretOccurrence(Base, FromDictMixin):
10531034
matches: List[OccurrenceMatch]
10541035
tags: List[str]
10551036
sha: Optional[str] # Commit sha
1056-
presence: OccurrencePresence
1037+
presence: str
10571038
filepath: Optional[str]
10581039

10591040

@@ -1077,12 +1058,12 @@ class SecretIncident(Base, FromDictMixin):
10771058
hmsl_hash: str
10781059
gitguardian_url: str
10791060
regression: bool
1080-
status: IncidentStatus
1061+
status: str
10811062
assignee_id: Optional[int]
10821063
assignee_email: Optional[str]
10831064
occurrences_count: int
10841065
secret_presence: SecretPresence
1085-
ignore_reason: Optional[IgnoreReason]
1066+
ignore_reason: Optional[str]
10861067
triggered_at: Optional[datetime]
10871068
ignored_at: Optional[datetime]
10881069
ignorer_id: Optional[int]
@@ -1094,7 +1075,7 @@ class SecretIncident(Base, FromDictMixin):
10941075
validity: ValidityStatus
10951076
resolved_at: Optional[datetime]
10961077
share_url: Optional[str]
1097-
tags: List[Tag]
1078+
tags: List[str]
10981079
feedback_list: List[Feedback]
10991080
occurrences: Optional[List[SecretOccurrence]]
11001081

@@ -1480,7 +1461,7 @@ class TeamSourceParameters(PaginationParameter, SearchParameter, ToDictMixin):
14801461
health: Optional[SourceHealth] = None
14811462
type: Optional[str] = None
14821463
ordering: Optional[Literal["last_scan_date", "-last_scan_date"]] = None
1483-
visibility: Optional[Visibility] = None
1464+
visibility: Optional[str] = None
14841465
external_id: Optional[str] = None
14851466

14861467

0 commit comments

Comments
 (0)