feat!: adapt auth client to authup camelCase management API - #117
feat!: adapt auth client to authup camelCase management API#117tada5hi wants to merge 2 commits into
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.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (1)
📝 WalkthroughWalkthroughAuthClient Pydantic models and public endpoint signatures now use camelCase fields and identifiers directly. Realm, permission, role, relationship, user, and client operations were updated, along with corresponding auth and flow tests. ChangescamelCase AuthClient API
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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
Take everything main brings (httpx2, per-request auth, the typing pass, Hub v0.12.5 and the error-response and client-authentication fixes) and keep this branch's explicit camelCase vocabulary on top of it. main adapted the auth client to authup's camelCase management API in 22f93a6 by keeping snake_case attributes and deriving the wire names with a pydantic alias generator (AuthBaseModel, alias_generator=to_camel). The generator is dropped here: attribute names are spelled out as the wire spells them, so the model is explicit about what is sent and received. It also covers what an alias generator cannot reach. rapiq query parameters are built from attribute names, so with snake_case attributes the client sends filter[realm_id], sort=created_at and include=role_realm, and authup silently ignores every key outside its allowed vocabulary instead of rejecting it: filter[realm_id]=<uuid> returns all users while filter[realmId]=<uuid> filters them. The client models and the robot removal are taken from main, with authMethod and tokenBindingMethod renamed to match.
|
Merged the latest One resolution is worth calling out. Beyond the preference for explicitness, an alias generator does not reach the query vocabulary. rapiq parameters are built from attribute names, so with snake_case attributes the client sends
Note that this branch alone is not yet enough to talk to beta.57: single-resource responses are wrapped in a |
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
camelCasenaming.