44import textwrap
55from typing import Annotated , Literal , Self
66
7- from pydantic import AfterValidator , BaseModel , Field , model_validator
7+ from pydantic import AfterValidator , Field , model_validator
8+
9+ from discord_guild_configurator ._utils import StrictBaseModel
810
911MultilineString = Annotated [
1012 str ,
7173]
7274
7375
74- class PermissionOverwrite (BaseModel ):
76+ class PermissionOverwrite (StrictBaseModel ):
7577 roles : list [str ]
7678 allow : list [Permission ] = Field (default_factory = list )
7779 deny : list [Permission ] = Field (default_factory = list )
7880
7981
80- class ForumChannel (BaseModel ):
82+ class ForumChannel (StrictBaseModel ):
8183 type : Literal ["forum" ] = "forum"
8284
8385 name : str
@@ -88,7 +90,7 @@ class ForumChannel(BaseModel):
8890 require_tag : bool = False
8991
9092
91- class TextChannel (BaseModel ):
93+ class TextChannel (StrictBaseModel ):
9294 type : Literal ["text" ] = "text"
9395
9496 name : str
@@ -98,30 +100,30 @@ class TextChannel(BaseModel):
98100 channel_messages : list [MultilineString ] = Field (default_factory = list )
99101
100102
101- class VoiceChannel (BaseModel ):
103+ class VoiceChannel (StrictBaseModel ):
102104 type : Literal ["voice" ] = "voice"
103105
104106 name : str
105107 permission_overwrites : list [PermissionOverwrite ] = Field (default_factory = list )
106108
107109
108- class Category (BaseModel ):
110+ class Category (StrictBaseModel ):
109111 name : str
110112 channels : list [
111113 Annotated [TextChannel | ForumChannel | VoiceChannel , Field (discriminator = "type" )]
112114 ]
113115 permission_overwrites : list [PermissionOverwrite ] = Field (default_factory = list )
114116
115117
116- class Role (BaseModel ):
118+ class Role (StrictBaseModel ):
117119 name : str
118120 color : str = Field (pattern = re .compile ("^#[0-9A-F]{6}$" ))
119121 hoist : bool = False
120122 mentionable : bool = False
121123 permissions : list [Permission ] = Field (default_factory = list )
122124
123125
124- class GuildConfig (BaseModel ):
126+ class GuildConfig (StrictBaseModel ):
125127 roles : list [Role ]
126128 rules_channel_name : str
127129 system_channel_name : str
0 commit comments