Skip to content

Commit

Permalink
refactor(typing): Remove some None cases for SchemaInfo
Browse files Browse the repository at this point in the history
Using an empty string is consistent with `dict`, `list` properties.
  • Loading branch information
dangotbanned committed Aug 17, 2024
1 parent 2781969 commit 9e1c8c4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions tools/schemapi/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -551,8 +551,8 @@ def additionalProperties(self) -> bool:
return self.schema.get("additionalProperties", True)

@property
def type(self) -> str | list[Any] | None:
return self.schema.get("type", None)
def type(self) -> str | list[Any]:
return self.schema.get("type", "")

@property
def anyOf(self) -> Iterator[SchemaInfo]:
Expand Down Expand Up @@ -594,8 +594,8 @@ def refname(self) -> str:
return self.raw_schema.get("$ref", "#/").split("/")[-1]

@property
def ref(self) -> str | None:
return self.raw_schema.get("$ref", None)
def ref(self) -> str:
return self.raw_schema.get("$ref", "")

@property
def description(self) -> str:
Expand Down Expand Up @@ -679,7 +679,7 @@ def is_union(self) -> bool:
Not a real class.
"""
return self.is_anyOf() and self.type is None
return self.is_anyOf() and not self.type

def is_union_literal(self) -> bool:
"""
Expand Down

0 comments on commit 9e1c8c4

Please sign in to comment.