Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions changelog.d/20251114_155241_kp2681_change_fields_to_string.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!--
A new scriv changelog fragment.

Uncomment the section that is right (remove the HTML comment wrapper).
-->

<!--
### Removed

- A bullet item for the Removed category.

-->
<!--
### Added

- A bullet item for the Added category.

-->

### Changed

- Changed the following fields to `str`: `visibility`, `kind`, `presence status`, `ignore_reason`, `tag`.

<!--
### Deprecated

- A bullet item for the Deprecated category.

-->
<!--
### Fixed

- A bullet item for the Fixed category.

-->
<!--
### Security

- A bullet item for the Security category.

-->
33 changes: 7 additions & 26 deletions pygitguardian/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -903,25 +903,6 @@ class Detector(Base, FromDictMixin):

Severity = Literal["info", "low", "medium", "high", "critical", "unknown"]
ValidityStatus = Literal["valid", "invalid", "failed_to_check", "no_checker", "unknown"]
IncidentStatus = Literal["IGNORED", "TRIGGERED", "RESOLVED", "ASSIGNED"]
Tag = Literal[
"DEFAULT_BRANCH",
"FROM_HISTORICAL_SCAN",
"CHECK_RUN_SKIP_FALSE_POSITIVE",
"CHECK_RUN_SKIP_LOW_RISK",
"CHECK_RUN_SKIP_TEST_CRED",
"IGNORED_IN_CHECK_RUN",
"FALSE_POSITIVE",
"PUBLICLY_EXPOSED",
"PUBLICLY_LEAKED",
"REGRESSION",
"SENSITIVE_FILE",
"TEST_FILE",
]
IgnoreReason = Literal["test_credential", "false_positive", "low_risk"]
OccurrenceKind = Literal["realtime", "historical"]
OccurrencePresence = Literal["present", "removed"]
Visibility = Literal["private", "internal", "public"]


@dataclass
Expand Down Expand Up @@ -1003,7 +984,7 @@ class Source(FromDictWithBase):
open_incidents_count: int
closed_incidents_count: int
secret_incidents_breakdown: SecretIncidentsBreakdown
visibility: Visibility
visibility: str
external_id: str
source_criticality: SourceCriticality
last_scan: Optional[Scan]
Expand Down Expand Up @@ -1044,7 +1025,7 @@ class OccurrenceMatch(Base, FromDictMixin):
class SecretOccurrence(Base, FromDictMixin):
id: int
incident_id: int
kind: OccurrenceKind
kind: str
source: Source
author_name: str
author_info: str
Expand All @@ -1053,7 +1034,7 @@ class SecretOccurrence(Base, FromDictMixin):
matches: List[OccurrenceMatch]
tags: List[str]
sha: Optional[str] # Commit sha
presence: OccurrencePresence
presence: str
filepath: Optional[str]


Expand All @@ -1077,12 +1058,12 @@ class SecretIncident(Base, FromDictMixin):
hmsl_hash: str
gitguardian_url: str
regression: bool
status: IncidentStatus
status: str
assignee_id: Optional[int]
assignee_email: Optional[str]
occurrences_count: int
secret_presence: SecretPresence
ignore_reason: Optional[IgnoreReason]
ignore_reason: Optional[str]
triggered_at: Optional[datetime]
ignored_at: Optional[datetime]
ignorer_id: Optional[int]
Expand All @@ -1094,7 +1075,7 @@ class SecretIncident(Base, FromDictMixin):
validity: ValidityStatus
resolved_at: Optional[datetime]
share_url: Optional[str]
tags: List[Tag]
tags: List[str]
feedback_list: List[Feedback]
occurrences: Optional[List[SecretOccurrence]]

Expand Down Expand Up @@ -1480,7 +1461,7 @@ class TeamSourceParameters(PaginationParameter, SearchParameter, ToDictMixin):
health: Optional[SourceHealth] = None
type: Optional[str] = None
ordering: Optional[Literal["last_scan_date", "-last_scan_date"]] = None
visibility: Optional[Visibility] = None
visibility: Optional[str] = None
external_id: Optional[str] = None


Expand Down
Loading