feat!: adapt auth client to authup camelCase management API#117
Conversation
authup renamed its entity/management-API vocabulary from snake_case to camelCase (authup/authup@c31b20ee9, "refactor!: camelCase entity properties, domain types & management API", #3273). Its OAuth2/OIDC protocol surface and JWT claims stay snake_case. Mirror that on the AuthClient: model fields, method keyword arguments and the rapiq filter/sort/field/include vocabulary move to camelCase (display_name -> displayName, realm_id -> realmId, role_id -> roleId, built_in -> builtIn, created_at -> createdAt, is_confidential -> isConfidential, the *_realm relation includes -> *Realm, ...). Because a pydantic field name is the wire key, the shared BaseClient and the CoreClient / StorageClient are untouched and stay snake_case (the FLAME Hub core/storage services did not change). The _auth_flows OAuth2 token surface (grant_type, client_id, client_secret, refresh_token, id, secret) stays snake_case. Docs and tests are updated to the camelCase vocabulary. BREAKING CHANGE: AuthClient model attributes, method keyword arguments and rapiq filter/sort/field/include keys are now camelCase.
📝 WalkthroughWalkthroughThe AuthClient Pydantic models and endpoint parameters now use camelCase names across resources, relationships, and clients. Tests and README/user-guide JSON examples were updated to match the renamed fields. ChangesAuthClient camelCase API migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning Review ran into problems🔥 ProblemsGit: Failed to clone repository. Please run the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (2)
flame_hub/_auth_client.py (2)
376-393: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low valuePre-existing
policyId=NoneTODO carried through the rename.
create_permissionstill hard-codespolicyId=Nonepending hub policy support. Not introduced here, but flagging so it isn't lost in the camelCase churn. Want me to open a tracking issue?🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flame_hub/_auth_client.py` around lines 376 - 393, The existing create_permission implementation still passes policyId=None; preserve this intentional TODO during the camelCase rename and do not remove or alter the field until hub policy support is implemented.
24-279: 📐 Maintainability & Code Quality | 🔵 Trivial | 🏗️ Heavy liftConsider keeping snake_case Python fields and adding camelCase aliases.
Renaming the model attributes themselves makes the client API a breaking change for downstream code;alias_generator=to_camelwithpopulate_by_name=Truewould preserve the Python surface while still serializing camelCase on the wire.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@flame_hub/_auth_client.py` around lines 24 - 279, Preserve the existing snake_case Python attribute names across the models in this diff instead of exposing camelCase names such as displayName, realmId, and createdAt. Configure the shared Pydantic model setup with alias_generator=to_camel and populate_by_name=True so Python callers use snake_case while request serialization and response parsing continue to use camelCase wire fields.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@flame_hub/_auth_client.py`:
- Around line 376-393: The existing create_permission implementation still
passes policyId=None; preserve this intentional TODO during the camelCase rename
and do not remove or alter the field until hub policy support is implemented.
- Around line 24-279: Preserve the existing snake_case Python attribute names
across the models in this diff instead of exposing camelCase names such as
displayName, realmId, and createdAt. Configure the shared Pydantic model setup
with alias_generator=to_camel and populate_by_name=True so Python callers use
snake_case while request serialization and response parsing continue to use
camelCase wire fields.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: d3c04c8d-4a37-4674-8483-71af45980f5e
📒 Files selected for processing (5)
README.mddocs/user_guide.rstflame_hub/_auth_client.pytests/test_auth.pytests/test_flow.py
What
authup renamed its entity / management-API vocabulary from snake_case → camelCase in
c31b20ee9("refactor!: camelCase entity properties, domain types & management API", authup#3273). The OAuth2/OIDC protocol surface and JWT claims deliberately stay snake_case in that change.This PR mirrors the rename onto
flame_hub'sAuthClient(which wraps authup's management API), so the client keeps working against the new authup.Changes
flame_hub/_auth_client.py— model fields, method keyword arguments, and the rapiq filter / sort / field / include vocabulary are now camelCase:display_name → displayName,realm_id → realmId,built_in → builtIn,created_at → createdAt,updated_at → updatedAt,name_locked → nameLocked,first_name → firstName,last_name → lastNameis_confidential → isConfidential,secret_hashed → secretHashed,secret_encrypted → secretEncrypted,grant_types → grantTypes,redirect_uri → redirectUri,base_url(client field)→ baseUrl,root_url → rootUrlrole_id → roleId,permission_id → permissionId,user_id → userId,robot_id → robotId,client_id → clientId,policy_id → policyId,*_realm_id → *RealmIdrole_realm → roleRealm,permission_realm → permissionRealm,user_realm → userRealm,robot_realm → robotRealmtests/test_auth.py,tests/test_flow.py,README.md,docs/user_guide.rst).Deliberately unchanged
BaseClient,CoreClient,StorageClient— untouched. A pydantic field name is the wire key, so no shared serialization changes were needed. The FLAME Hub core/storage services did not change and stay snake_case (so users never see mixed casing within one service)._auth_flows.py— the OAuth2/tokensurface (grant_type,client_id,client_secret,refresh_token,id,secret, …) stays snake_case, matching authup's frozen protocol surface.RobotAuth/ClientAuthcredential kwargs are unchanged.auth_methodreplacingis_confidential, rapiq v2) are not in scope here.Verification
ruff format+ruff checkclean.58 passed.get_includable_names(...)returns the camelCase relation names.-m integration, need a live Hub) were not run locally.Note
The deployed FLAME Hub / authup image must serve the plan-073 camelCase API for the integration suite (and real usage) to pass — this client change should land together with (or after) the corresponding Hub/authup bump.
Breaking change
AuthClientmodel attributes, method keyword arguments, and rapiq filter/sort/field/include keys are now camelCase.Summary by CodeRabbit
Enhancements
Documentation