Skip to content

Commit

Permalink
Merge pull request #528 from tisnik/refactoring-using-optional-type
Browse files Browse the repository at this point in the history
Refactoring: using `Optional` type instead of `Union[something, None]`
  • Loading branch information
tisnik authored Nov 6, 2023
2 parents 41bc292 + 4aa8d8e commit 2101ffd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions mocks/service-log/service_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
import string

from datetime import datetime
from typing import Union
from typing import Optional

from fastapi import FastAPI, Request, Response, status
from fastapi.exceptions import RequestValidationError
Expand Down Expand Up @@ -114,16 +114,16 @@ class Log(BaseModel):
"""Model for log structure received by Service Log."""

cluster_uuid: str
cluster_id: Union[str, None] = None
subscription_id: Union[str, None] = None
cluster_id: Optional[str] = None
subscription_id: Optional[str] = None
summary: str
description: Union[str, None] = None
internal_only: Union[bool, None] = None
description: Optional[str] = None
internal_only: Optional[bool] = None
service_name: str
severity: Union[str, None] = "Info"
timestamp: Union[str, None] = None # default will be current time
username: Union[str, None] = None
event_stream_id: Union[str, None] = None # default will be a random ksuid
severity: Optional[str] = "Info"
timestamp: Optional[str] = None # default will be current time
username: Optional[str] = None
event_stream_id: Optional[str] = None # default will be a random ksuid


class ReturnLog(Log):
Expand Down

0 comments on commit 2101ffd

Please sign in to comment.