Skip to content

Commit

Permalink
Handle missing project
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewelwell committed Feb 13, 2024
1 parent 46d4f84 commit f9abc31
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
6 changes: 5 additions & 1 deletion flagsmith_admin_client/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class Environment(_BaseModel):

class Feature(_BaseModel):
name: str
project_id: int = Field(validation_alias=AliasChoices("project_id", "project"), serialization_alias="project")
project_id: int = Field(
validation_alias=AliasChoices("project_id", "project"),
serialization_alias="project",
default=None
)


class SegmentCondition(_BaseModel):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_unit_models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from flagsmith_admin_client.models import Feature


def test_feature() -> None:
assert Feature.model_validate({"id": 1, "name": "foo"}).name == "foo"

0 comments on commit f9abc31

Please sign in to comment.