Skip to content
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

Refactoring: using Optional type instead of Union[something, None] #528

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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