Skip to content

Commit

Permalink
downgrade errors to warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
snopoke committed Nov 8, 2024
1 parent 5128dbc commit beddca4
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions apps/custom_actions/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import logging

from django.contrib.postgres.fields import ArrayField
from django.core.exceptions import ValidationError
from django.db import models, transaction
Expand All @@ -17,6 +19,8 @@
from apps.teams.models import BaseTeamModel
from apps.utils.models import VersioningMixin

log = logging.getLogger("ocs.custom_actions")


@audit_fields("team", "name", "prompt", "api_schema", audit_special_queryset_writes=True)
class CustomAction(BaseTeamModel):
Expand Down Expand Up @@ -128,14 +132,15 @@ def __str__(self):
def operation_schema(self) -> dict:
if not self._operation_schema:
if self.working_version_id:
raise ValueError("Missing OpenAPI spec for versioned operation")
log.warning("Versioned model is missing 'operation_schema'")
return get_standalone_schema_for_action_operation(self)
return self._operation_schema

@operation_schema.setter
def operation_schema(self, spec: dict):
if not self.working_version_id:
raise ValueError("Working Version should not have 'operation_schema' set")
log.warning("Working Version should not have 'operation_schema' set")
return
self._operation_schema = spec

def get_model_id(self, with_holder=True):
Expand Down

0 comments on commit beddca4

Please sign in to comment.