Skip to content

Commit dd49e4f

Browse files
chore(user_group): add create, update input type and readonly type.
1 parent 61eafe8 commit dd49e4f

File tree

3 files changed

+88
-10
lines changed

3 files changed

+88
-10
lines changed

functions/definition/userGroup.yaml

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# yaml-language-server: $schema=https://raw.githubusercontent.com/toggle-corp/typesync/refs/tags/v1.0.0/schema.local.json
22

3-
FbUserGroup:
3+
FbUserGroupReadOnlyType:
44
model: alias
55
# path: userGroups/{userGroupId}
66
docs: Represents a usergroup
@@ -19,10 +19,46 @@ FbUserGroup:
1919
type: string
2020
deprecated: true
2121
users:
22+
optional: true
2223
type:
2324
type: map
2425
valueType: unknown
2526

27+
FbUserGroupCreateOnlyInput:
28+
model: alias
29+
# path: userGroups/{userGroupId}
30+
docs: Represents a usergroup
31+
type:
32+
type: object
33+
fields:
34+
createdAt:
35+
type: int
36+
createdBy:
37+
type: string
38+
description:
39+
type: string
40+
name:
41+
type: string
42+
nameKey:
43+
type: string
44+
deprecated: true
45+
46+
FbUserGroupUpdateInput:
47+
model: alias
48+
# path: userGroups/{userGroupId}
49+
docs: Represents a usergroup
50+
type:
51+
type: object
52+
fields:
53+
description:
54+
type: string
55+
name:
56+
type: string
57+
nameKey:
58+
type: string
59+
deprecated: true
60+
61+
2662
FbUserGroupObsolete:
2763
model: alias
2864
# path: user_groups/{userGroupId}

functions/generated/pyfirebase/pyfirebase_mapswipe/extended_models.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,14 @@ class Config: # type: ignore[reportIncompatibleVariableOverride]
3737
use_enum_values = True
3838
frozen = True
3939
extra = "forbid"
40+
41+
42+
class FbUserGroup(
43+
models.FbUserGroupCreateOnlyInput,
44+
models.FbUserGroupUpdateInput,
45+
models.FbUserGroupReadOnlyType,
46+
):
47+
class Config: # type: ignore[reportIncompatibleVariableOverride]
48+
use_enum_values = True
49+
frozen = True
50+
extra = "forbid"

functions/generated/pyfirebase/pyfirebase_mapswipe/models.py

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class TypesyncUndefined:
1616
def __init__(self):
1717
if TypesyncUndefined._instance is not None:
1818
raise RuntimeError(
19-
"TypesyncUndefined instances cannot be created directly. Import and use the UNDEFINED sentinel instead.",
19+
"TypesyncUndefined instances cannot be created directly. Import and use the UNDEFINED sentinel instead."
2020
)
2121
TypesyncUndefined._instance = self
2222

@@ -175,8 +175,7 @@ class FbObjRasterTileServer(TypesyncModel):
175175

176176
apiKey: str | TypesyncUndefined | None = UNDEFINED
177177
wmtsLayerName: typing.Annotated[
178-
str | TypesyncUndefined | None,
179-
pydantic.Field(deprecated=True),
178+
str | TypesyncUndefined | None, pydantic.Field(deprecated=True)
180179
] = UNDEFINED
181180
credits: str
182181
name: FbEnumRasterTileServerName
@@ -684,12 +683,10 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
684683

685684
class FbBaseTutorial(TypesyncModel):
686685
exampleImage1: typing.Annotated[
687-
str | TypesyncUndefined | None,
688-
pydantic.Field(deprecated=True),
686+
str | TypesyncUndefined | None, pydantic.Field(deprecated=True)
689687
] = UNDEFINED
690688
exampleImage2: typing.Annotated[
691-
str | TypesyncUndefined | None,
692-
pydantic.Field(deprecated=True),
689+
str | TypesyncUndefined | None, pydantic.Field(deprecated=True)
693690
] = UNDEFINED
694691
contributorCount: int
695692
informationPages: list[FbInformationPage]
@@ -980,15 +977,49 @@ def __setattr__(self, name: str, value: typing.Any) -> None:
980977
super().__setattr__(name, value)
981978

982979

983-
class FbUserGroup(TypesyncModel):
980+
class FbUserGroupReadOnlyType(TypesyncModel):
984981
"""Represents a usergroup"""
985982

986983
createdAt: int
987984
createdBy: str
988985
description: str
989986
name: str
990987
nameKey: typing.Annotated[str, pydantic.Field(deprecated=True)]
991-
users: dict[str, typing.Any]
988+
users: dict[str, typing.Any] | TypesyncUndefined | None = UNDEFINED
989+
990+
class Config:
991+
use_enum_values = True
992+
extra = "forbid"
993+
994+
def __setattr__(self, name: str, value: typing.Any) -> None:
995+
if name == "users" and value is None:
996+
raise ValueError("'users' field cannot be set to None")
997+
super().__setattr__(name, value)
998+
999+
1000+
class FbUserGroupCreateOnlyInput(TypesyncModel):
1001+
"""Represents a usergroup"""
1002+
1003+
createdAt: int
1004+
createdBy: str
1005+
description: str
1006+
name: str
1007+
nameKey: typing.Annotated[str, pydantic.Field(deprecated=True)]
1008+
1009+
class Config:
1010+
use_enum_values = True
1011+
extra = "forbid"
1012+
1013+
def __setattr__(self, name: str, value: typing.Any) -> None:
1014+
super().__setattr__(name, value)
1015+
1016+
1017+
class FbUserGroupUpdateInput(TypesyncModel):
1018+
"""Represents a usergroup"""
1019+
1020+
description: str
1021+
name: str
1022+
nameKey: typing.Annotated[str, pydantic.Field(deprecated=True)]
9921023

9931024
class Config:
9941025
use_enum_values = True

0 commit comments

Comments
 (0)