Api v1.17.0 (#1799)
* refactor(crons): upgraded dependencies (#1781) refactor(alerts): upgraded dependencies refactor(chalice): upgraded dependencies * Api v1.17.0 (#1798) * fix(chalice): support list of errors in response * refactor(chalice): global support of missing filter attribute isEvent
This commit is contained in:
parent
2cbcdbb096
commit
ca374a1c82
8 changed files with 35 additions and 31 deletions
|
|
@ -33,7 +33,8 @@ class ORRoute(APIRoute):
|
|||
response: Response = await original_route_handler(request)
|
||||
except HTTPException as e:
|
||||
if e.status_code // 100 == 4:
|
||||
return JSONResponse(content={"errors": [e.detail]}, status_code=e.status_code)
|
||||
return JSONResponse(content={"errors": e.detail if isinstance(e.detail, list) else [e.detail]},
|
||||
status_code=e.status_code)
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Keep this version to not have conflicts between requests and boto3
|
||||
urllib3==1.26.16
|
||||
requests==2.31.0
|
||||
boto3==1.33.8
|
||||
boto3==1.34.1
|
||||
pyjwt==2.8.0
|
||||
psycopg2-binary==2.9.9
|
||||
psycopg[pool,binary]==3.1.14
|
||||
elasticsearch==8.11.0
|
||||
psycopg[pool,binary]==3.1.15
|
||||
elasticsearch==8.11.1
|
||||
jira==3.5.2
|
||||
|
||||
|
||||
|
||||
fastapi==0.104.1
|
||||
fastapi==0.105.0
|
||||
uvicorn[standard]==0.23.2
|
||||
python-decouple==3.8
|
||||
pydantic[email]==2.3.0
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Keep this version to not have conflicts between requests and boto3
|
||||
urllib3==1.26.16
|
||||
requests==2.31.0
|
||||
boto3==1.33.8
|
||||
boto3==1.34.1
|
||||
pyjwt==2.8.0
|
||||
psycopg2-binary==2.9.9
|
||||
psycopg[pool,binary]==3.1.14
|
||||
elasticsearch==8.11.0
|
||||
psycopg[pool,binary]==3.1.15
|
||||
elasticsearch==8.11.1
|
||||
jira==3.5.2
|
||||
|
||||
|
||||
|
||||
fastapi==0.104.1
|
||||
fastapi==0.105.0
|
||||
uvicorn[standard]==0.23.2
|
||||
python-decouple==3.8
|
||||
pydantic[email]==2.3.0
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ from chalicelib.utils.TimeUTC import TimeUTC
|
|||
from .overrides import BaseModel, Enum, ORUnion
|
||||
from .transformers_validators import transform_email, remove_whitespace, remove_duplicate_values, single_to_list, \
|
||||
force_is_event, NAME_PATTERN, int_to_string
|
||||
from pydantic.functional_validators import BeforeValidator
|
||||
|
||||
|
||||
def transform_old_filter_type(cls, values):
|
||||
|
|
@ -700,9 +701,17 @@ class SortOrderType(str, Enum):
|
|||
desc = "DESC"
|
||||
|
||||
|
||||
def add_missing_is_event(values: dict):
|
||||
if values.get("isEvent") is None:
|
||||
values["isEvent"] = (EventType.has_value(values["type"])
|
||||
or PerformanceEventType.has_value(values["type"])
|
||||
or ProductAnalyticsSelectedEventType.has_value(values["type"]))
|
||||
return values
|
||||
|
||||
|
||||
# this type is created to allow mixing events&filters and specifying a discriminator
|
||||
GroupedFilterType = Annotated[Union[SessionSearchFilterSchema, SessionSearchEventSchema2], \
|
||||
Field(discriminator='is_event')]
|
||||
Field(discriminator='is_event'), BeforeValidator(add_missing_is_event)]
|
||||
|
||||
|
||||
class SessionsSearchPayloadSchema(_TimedSchema, _PaginatedSchema):
|
||||
|
|
@ -732,9 +741,9 @@ class SessionsSearchPayloadSchema(_TimedSchema, _PaginatedSchema):
|
|||
for v in values["events"]:
|
||||
v["isEvent"] = True
|
||||
|
||||
for v in values.get("filters", []):
|
||||
if v.get("isEvent") is None:
|
||||
v["isEvent"] = False
|
||||
# for v in values.get("filters", []):
|
||||
# if v.get("isEvent") is None:
|
||||
# v["isEvent"] = False
|
||||
return values
|
||||
|
||||
@model_validator(mode="before")
|
||||
|
|
@ -1016,13 +1025,6 @@ class CardSessionsSchema(_TimedSchema, _PaginatedSchema):
|
|||
f["value"] = vals
|
||||
return values
|
||||
|
||||
@model_validator(mode="before")
|
||||
def __force_is_event(cls, values):
|
||||
for v in values.get("filters", []):
|
||||
if v.get("isEvent") is None:
|
||||
v["isEvent"] = ProductAnalyticsSelectedEventType.has_value(v["type"])
|
||||
return values
|
||||
|
||||
@model_validator(mode="before")
|
||||
def __enforce_default(cls, values):
|
||||
if values.get("startTimestamp") is None:
|
||||
|
|
|
|||
|
|
@ -35,7 +35,8 @@ class ORRoute(APIRoute):
|
|||
response: Response = await original_route_handler(request)
|
||||
except HTTPException as e:
|
||||
if e.status_code // 100 == 4:
|
||||
response = JSONResponse(content={"errors": [e.detail]}, status_code=e.status_code)
|
||||
return JSONResponse(content={"errors": e.detail if isinstance(e.detail, list) else [e.detail]},
|
||||
status_code=e.status_code)
|
||||
else:
|
||||
raise e
|
||||
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Keep this version to not have conflicts between requests and boto3
|
||||
urllib3==1.26.16
|
||||
requests==2.31.0
|
||||
boto3==1.29.7
|
||||
boto3==1.34.1
|
||||
pyjwt==2.8.0
|
||||
psycopg2-binary==2.9.9
|
||||
psycopg[pool,binary]==3.1.14
|
||||
psycopg[pool,binary]==3.1.15
|
||||
elasticsearch==8.11.0
|
||||
jira==3.5.2
|
||||
|
||||
|
||||
|
||||
fastapi==0.104.1
|
||||
fastapi==0.105.0
|
||||
uvicorn[standard]==0.23.2
|
||||
python-decouple==3.8
|
||||
pydantic[email]==2.3.0
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Keep this version to not have conflicts between requests and boto3
|
||||
urllib3==1.26.16
|
||||
requests==2.31.0
|
||||
boto3==1.29.7
|
||||
boto3==1.34.1
|
||||
pyjwt==2.8.0
|
||||
psycopg2-binary==2.9.9
|
||||
psycopg[pool,binary]==3.1.14
|
||||
psycopg[pool,binary]==3.1.15
|
||||
elasticsearch==8.11.0
|
||||
jira==3.5.2
|
||||
|
||||
|
||||
|
||||
fastapi==0.104.1
|
||||
fastapi==0.105.0
|
||||
python-decouple==3.8
|
||||
pydantic[email]==2.3.0
|
||||
apscheduler==3.10.4
|
||||
|
|
|
|||
|
|
@ -1,16 +1,16 @@
|
|||
# Keep this version to not have conflicts between requests and boto3
|
||||
urllib3==1.26.16
|
||||
requests==2.31.0
|
||||
boto3==1.29.7
|
||||
boto3==1.34.1
|
||||
pyjwt==2.8.0
|
||||
psycopg2-binary==2.9.9
|
||||
psycopg[pool,binary]==3.1.14
|
||||
elasticsearch==8.11.0
|
||||
psycopg[pool,binary]==3.1.15
|
||||
elasticsearch==8.11.1
|
||||
jira==3.5.2
|
||||
|
||||
|
||||
|
||||
fastapi==0.104.1
|
||||
fastapi==0.105.0
|
||||
uvicorn[standard]==0.23.2
|
||||
gunicorn==21.2.0
|
||||
python-decouple==3.8
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue