Skip to content

Commit

Permalink
fix(crons): Add missing API docs for project / config
Browse files Browse the repository at this point in the history
Fixes GH-85534
  • Loading branch information
evanpurkhiser committed Feb 28, 2025
1 parent 7483da5 commit 94000bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/sentry/api/serializers/rest_framework/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@

@extend_schema_field(field=OpenApiTypes.STR)
class ProjectField(serializers.Field):
def __init__(self, scope="project:write", id_allowed=False):
def __init__(self, scope="project:write", id_allowed=False, **kwags):
self.scope = scope
self.id_allowed = id_allowed
super().__init__()
super().__init__(**kwags)

def to_representation(self, value):
return value
Expand Down
12 changes: 8 additions & 4 deletions src/sentry/monitors/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,16 @@ def validate(self, attrs):
return attrs


@extend_schema_serializer(exclude_fields=["project", "config", "alert_rule"])
@extend_schema_serializer(exclude_fields=["alert_rule"])
class MonitorValidator(CamelSnakeSerializer):
project = ProjectField(scope="project:read")
project = ProjectField(
scope="project:read",
required=True,
help_text="The project to associate the monitor to.",
)
name = serializers.CharField(
max_length=128,
help_text="Name of the monitor. Used for notifications.",
help_text="Name of the monitor. Used for notifications. If not set the slug will be derived from your monitor name.",
)
slug = SentrySerializerSlugField(
max_length=DEFAULT_SLUG_MAX_LENGTH,
Expand All @@ -275,7 +279,7 @@ class MonitorValidator(CamelSnakeSerializer):
required=False,
default="cron_job",
)
config = ConfigValidator()
config = ConfigValidator(help_text="The configuration for the monitor.")
alert_rule = MonitorAlertRuleValidator(required=False)

def validate_status(self, value):
Expand Down

0 comments on commit 94000bd

Please sign in to comment.