Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
from enum import Enum
"""
Optional types.
"""

from types import NoneType, UnionType
from typing import Annotated, Any, Generic, TypeVar, Union, get_args, get_origin

Expand Down Expand Up @@ -71,18 +74,6 @@ def __class_getitem__(cls, item: Any) -> Any:
return Annotated[item | MISSING, Field(default=MISSING)]


# todo - Vic - finish this
class Optionality(str, Enum):
# This is for implementing the model constraints more cleverly.
# Noneable -> It is allowed to be `null` in JSON Schema.
# To make it @required, need to take away the right to set `null`.
#
#
OMITABLE = ("omitable",)
NONEABLE = ("noneable",)
NOT_OPTIONAL = ("not_optional",)
Comment thread
vcschapp marked this conversation as resolved.


def _has_none(value: Any) -> bool:
if value is None or value is NoneType:
return True
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@


class Relationship(str, DocumentedEnum):
"""
r"""
The kind of relationship that exists between two entities.

Relationships represent connections between different features or models. Think of them as links
Expand All @@ -33,9 +33,9 @@ class Relationship(str, DocumentedEnum):
relationship, is at the bottom.

COMPOSITION
/ \\
/ \
AGGREGATION HIERARCHY
\\ /
\ /
ASSOCIATION

Note that the *kind* of a relationship does not say anything about the *directionality* of the
Expand Down