-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(incidents): implement models and client for /incidents/secrets/ #115
feat(incidents): implement models and client for /incidents/secrets/ #115
Conversation
ccd992f
to
4b05ac9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor remarks, but thanks for this not-so-fun work.
tests/test_models.py
Outdated
if callable(schema_klass): | ||
schema = schema_klass() | ||
else: | ||
schema = schema_klass |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is some kind of undocumented standard to declare our models and their schema. It looks like this:
@dataclass
class Foo(Base, FromDictMixin):
# fields
FooSchema = cast(
Type[BaseSchema], marshmallow_dataclass.class_schema(Foo, BaseSchema)
)
Foo.SCHEMA = FooSchema()
If you do this for the schemas you are testing here, you won't need these changes and the code will be a little more consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hum I was not entirely sure I understood your suggestion but I think successfully applied it ? 😅
changelog.d/20240823_170420_fnareoh_scrt_4759_optimize_files_to_scan_on_merge_commits.md
Outdated
Show resolved
Hide resolved
pygitguardian/client.py
Outdated
retrieve_secret_incident handles the /incidents/secret/{incident_id} endpoint of the API | ||
|
||
:param incident_id: incident id | ||
:param with_occurrences: number of occurrences of the incident to retrieve (default 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you clarify whether 0
means no occurrences are retrieved or if it means the server uses its own default value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had put 0 when I didn't think we wanted occurrences but I meant to change this default to 20 (which is the default of the API), done now.
4b05ac9
to
91cd3f8
Compare
91cd3f8
to
dce0ec3
Compare
Implement this endpoint to later display more information in ggshield.
After discussion with Aurélien, we chose to use Litteral when string values are known to be part of limited number of options. We chose not to use Enum in order not to be too restrictive and risk breaking change when a new return value is added in the API.