-
Notifications
You must be signed in to change notification settings - Fork 291
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
Improve OpenAPI schema coverage #3629
Conversation
@@ -54,101 +58,62 @@ def get_user_queryset(request): | |||
return User.objects.filter(organization=request.user.organization).distinct() | |||
|
|||
|
|||
class AlertGroupFilterBackend(filters.DjangoFilterBackend): |
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.
Removing this as it doesn't work (the number of SQL queries is the same without this code)
class AlertGroupFilter(DateRangeFilterMixin, ModelFieldFilterMixin, filters.FilterSet): | ||
""" | ||
Examples of possible date formats here https://docs.djangoproject.com/en/1.9/ref/settings/#datetime-input-formats | ||
""" | ||
|
||
FILTER_BY_INVOLVED_USERS_ALERT_GROUPS_CUTOFF = 1000 | ||
|
||
started_at_gte = filters.DateTimeFilter(field_name="started_at", lookup_expr="gte") |
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.
Removing outdated fields:
started_at_gte
started_at_lte
resolved_at_gte
resolved_at_lte
id__in
class Meta: | ||
model = AlertGroup | ||
fields = [ | ||
"id__in", | ||
"started_at_gte", | ||
"started_at_lte", | ||
"resolved_at_lte", | ||
"is_root", | ||
"resolved_by", | ||
"acknowledged_by", | ||
] | ||
|
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.
this is not needed, the filters work the same way without this
@@ -305,15 +268,12 @@ class AlertGroupView( | |||
"preview_template": [RBACPermission.Permissions.INTEGRATIONS_TEST], | |||
} | |||
|
|||
http_method_names = ["get", "post", "delete"] |
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.
this is outdated
@action(methods=["get"], detail=False) | ||
def filters(self, request): | ||
""" | ||
Retrieve a list of valid filter options that can be used to filter alert groups | ||
""" | ||
filter_name = request.query_params.get("search", None) |
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.
this is outdated/not used by API clients
@action(methods=["get"], detail=False) | ||
def filters(self, request): | ||
organization = self.request.auth.organization | ||
filter_name = request.query_params.get("search", None) |
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.
this is outdated/not used by API clients
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.
simplifying paginators + adding schema for them
…into vadimkerr/openapi-improvements
# Conflicts: # engine/apps/api/views/user.py
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.
LGTM, could probably use another quick pass by someone else given the size 🙂
Improves OpenAPI schema coverage for internal API: - Fixes/Improves `alert group` and `feature` endpoints - Adds `integration` and `user` endpoints #3444 - [x] Unit, integration, and e2e (if applicable) tests updated - [x] Documentation added (or `pr:no public docs` PR label added if not required) - [x] `CHANGELOG.md` updated (or `pr:no changelog` PR label added if not required)
What this PR does
Improves OpenAPI schema coverage for internal API:
alert group
andfeature
endpointsintegration
anduser
endpointsWhich issue(s) this PR fixes
#3444
Checklist
pr:no public docs
PR label added if not required)CHANGELOG.md
updated (orpr:no changelog
PR label added if not required)