Checks
Reproducible example
from pyticktick import Client
client = Client(
v1_client_id="...",
v1_client_secret="...",
v1_token={"value": "...", "expiration": 123},
v2_username="user@example.com",
v2_password="password",
override_forbid_extra=True,
)
pydantic_core._pydantic_core.ValidationError: 1 validation error for Client
registerDate
Extra inputs are not permitted by default. Please set `override_forbid_extra`
to `True` if you believe the TickTick API has diverged from the model.
[type=custom_pyticktick_extra_forbidden,
input_value='2023-07-25T17:48:35.000+0000', input_type=str]
Log output
Issue description
The TickTick API now returns a registerDate field in the v2 signon response that UserSignOnV2 does not define. Since BaseModelV2 uses extra="forbid", validation fails.
override_forbid_extra=True does not help because v2_signon is a @classmethod — it calls UserSignOnV2.model_validate(resp) without access to self.override_forbid_extra and without calling update_model_config first.
This pattern works correctly for later API calls (e.g. get_user_profile_v2, get_batch_v2) where the instance method checks the flag and calls update_model_config(Model, extra="allow") before validation. But this is missing from the signon flow in Settings._get_v2_token() / v2_signon().
Expected Behavior
With override_forbid_extra=True, the client should accept extra fields in the v2 signon response, just like it does for other v2 API calls.
Current Workaround
Manually patch the model before creating the client:
from pyticktick.pydantic import update_model_config
from pyticktick.models.v2.responses.user import UserSignOnV2
update_model_config(UserSignOnV2, extra="allow")
client = Client(...) # now v2 signon works
Suggested Fix
In Settings._get_v2_token() (or v2_signon), apply update_model_config(UserSignOnV2, extra="allow") when self.override_forbid_extra is True, before calling UserSignOnV2.model_validate(resp). Alternatively, add registerDate as an optional field to UserSignOnV2.
Is there a better or intended way to handle this that I'm missing?
Environment
- pyticktick >= 0.0.3
- Python 3.12
- Windows
Checks
Reproducible example
Log output
Issue description
The TickTick API now returns a
registerDatefield in the v2 signon response thatUserSignOnV2does not define. SinceBaseModelV2usesextra="forbid", validation fails.override_forbid_extra=Truedoes not help becausev2_signonis a@classmethod— it callsUserSignOnV2.model_validate(resp)without access toself.override_forbid_extraand without callingupdate_model_configfirst.This pattern works correctly for later API calls (e.g.
get_user_profile_v2,get_batch_v2) where the instance method checks the flag and callsupdate_model_config(Model, extra="allow")before validation. But this is missing from the signon flow inSettings._get_v2_token()/v2_signon().Expected Behavior
With
override_forbid_extra=True, the client should accept extra fields in the v2 signon response, just like it does for other v2 API calls.Current Workaround
Manually patch the model before creating the client:
Suggested Fix
In
Settings._get_v2_token()(orv2_signon), applyupdate_model_config(UserSignOnV2, extra="allow")whenself.override_forbid_extraisTrue, before callingUserSignOnV2.model_validate(resp). Alternatively, addregisterDateas an optional field toUserSignOnV2.Is there a better or intended way to handle this that I'm missing?
Environment