clerk / clerk/clerk-sdk-python

GetUserListRequest emits DeprecationWarning during local query param serialization even when only non-deprecated fields are set

Open
#231 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
186
Forks
47
Avg merge
18h 43m
Merged PRs (30d)
1

Description

Description

Serializing GetUserListRequest emits a DeprecationWarning even when the request only sets non-deprecated fields.

This can be reproduced without making any network call. The warning appears during local query param serialization.

SDK Version

  • clerk-backend-api==5.0.6

Python Version

  • Python 3.12.13

Minimal Reproduction

import warnings
from clerk_backend_api import models, utils

request = models.GetUserListRequest(
email_address=['smoke@example.com'],
limit=1,
)

with warnings.catch_warnings(record=True) as caught:
warnings.simplefilter('always')
params = utils.get_query_params(request)

print(params)
print('warnings', len(caught))
for warning in caught:
print(
type(warning.message).__name__,
str(warning.message),
'file=',
warning.filename,
'line=',
warning.lineno,
)

Actual Behavior

This produces output like:

{'email_address': ['smoke@example.com'], 'limit': ['1'], 'offset': ['0'], 'order_by': ['-created_at']}
warnings 1
DeprecationWarning warning: ** DEPRECATED ** - This will be removed in a future release, please migrate away from it as soon as possible. file= /.../site-packages/clerk_backend_api/utils/queryparams.py line= 65

Expected Behavior

No deprecation warning should be emitted unless the caller explicitly uses a deprecated request field.

Likely Cause

GetUserListRequest includes a deprecated field:

  • last_active_at_since

and the generated serializer appears to access all model fields during query param population, which triggers the warning even when that field is unset.

Why This Matters

This shows up in normal usage of clerk.users.list(...) and creates noisy test output for valid code paths that are not using deprecated API fields.

Notes

The warning happens during SDK-side query param serialization, not during the network request itself.

Possible Fix Direction

A possible fix would be to avoid triggering deprecated field access for unset/default query-model fields during serialization, while still preserving warnings when deprecated fields are explicitly provided.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with clerk_backend_api/utils/queryparams.py, especially the serialization path reported at line 65, and reproduce the warning with utils.get_query_params on GetUserListRequest. Check how the deprecated last_active_at_since field is accessed when unset; done means non-deprecated fields serialize without a warning while explicitly provided deprecated fields still warn.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
62/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.