Skip to content

Commit

Permalink
ConnectionType Optional (#1480)
Browse files Browse the repository at this point in the history
Co-authored-by: anders-albert <[email protected]>
  • Loading branch information
andeplane and doctrino authored Nov 8, 2023
1 parent 093a30a commit aef945c
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ Changes are grouped as follows
- `Fixed` for any bug fixes.
- `Security` in case of vulnerabilities.

## [6.39.3] - 2023-11-08
## Fixed
- The newely introduced parameter `connectionType` was assumed to be required from the API. This is not the case.

## [6.39.2] - 2023-11-08
## Fixed
- When listing `client.data_modeling.views` the SDK raises a `TypeError`. This is now fixed.
Expand Down
2 changes: 1 addition & 1 deletion cognite/client/_version.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from __future__ import annotations

__version__ = "6.39.2"
__version__ = "6.39.3"
__api_subversion__ = "V20220125"
18 changes: 12 additions & 6 deletions cognite/client/data_classes/data_modeling/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -390,15 +390,18 @@ class SingleHopConnectionDefinition(ConnectionDefinition):

@classmethod
def load(cls, data: dict[str, Any]) -> SingleHopConnectionDefinition:
return cls(
instance = cls(
type=DirectRelationReference.load(data["type"]),
source=ViewId.load(data["source"]),
name=data.get("name"),
description=data.get("description"),
edge_source=(edge_source := data.get("edgeSource")) and ViewId.load(edge_source),
direction=data["direction"],
connection_type=data["connectionType"],
)
if "direction" in data:
instance.direction = data["direction"]
if "connectionType" in data:
instance.connection_type = data["connectionType"]
return instance

def dump(self, camel_case: bool = False) -> dict[str, Any]:
output = asdict(self)
Expand Down Expand Up @@ -448,15 +451,18 @@ class SingleHopConnectionDefinitionApply(ConnectionDefinitionApply):

@classmethod
def load(cls, data: dict[str, Any]) -> SingleHopConnectionDefinitionApply:
return cls(
instance = cls(
type=DirectRelationReference.load(data["type"]),
source=ViewId.load(data["source"]),
name=data.get("name"),
description=data.get("description"),
edge_source=(edge_source := data.get("edgeSource")) and ViewId.load(edge_source),
direction=data["direction"],
connection_type=data["connectionType"],
)
if "direction" in data:
instance.direction = data["direction"]
if "connectionType" in data:
instance.connection_type = data["connectionType"]
return instance

def dump(self, camel_case: bool = False) -> dict:
output: dict[str, Any] = {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[tool.poetry]
name = "cognite-sdk"

version = "6.39.2"
version = "6.39.3"
description = "Cognite Python SDK"
readme = "README.md"
documentation = "https://cognite-sdk-python.readthedocs-hosted.com"
Expand Down

0 comments on commit aef945c

Please sign in to comment.