Skip to content

refactor(core): add sdk re-export convention for api types#257

Merged
harishsundar-okta merged 5 commits intomainfrom
refactor/replace-custom-api-types-with-sdk-exports
May 6, 2026
Merged

refactor(core): add sdk re-export convention for api types#257
harishsundar-okta merged 5 commits intomainfrom
refactor/replace-custom-api-types-with-sdk-exports

Conversation

@harishsundar-okta
Copy link
Copy Markdown
Contributor

@harishsundar-okta harishsundar-okta commented Apr 17, 2026

Summary

Documents all intentionally custom API request/response types and adds an SDK re-export convention to prevent type drift when SDK packages are updated.

Why

Custom types that mirror SDK API request/response shapes were scattered across the codebase with no documentation explaining whether they were intentional or simply missing SDK re-exports. When SDK packages are updated, these custom types must be manually synced with no compiler error to flag drift. An audit of all ~38 custom API types confirmed they are either already SDK re-exports or intentionally custom (no SDK equivalent available), but this was not documented anywhere.

What

  • Audited all custom API request/response types across the codebase against @auth0/myorganization-js, @auth0/myaccount-js, and @auth0/auth0-spa-js SDK exports
  • Added JSDoc comments to intentionally custom types explaining why they can't be replaced with SDK re-exports:
  • mfa-step-up-api-types.ts — ~23 types for raw /auth/mfa/* endpoints (@auth0/auth0-spa-js has equivalents but is not a core dependency)
  • auth-types.ts — TokenEndpointResponse and FetcherAuthParams (internal abstractions, no SDK dependency available)
  • organization-details-types.ts — OrganizationPrivate and Organization (hybrid form+API types, not pure SDK shapes)
  • mfa-types.ts — EnrollOptions and ConfirmEnrollmentOptions (simplified internal abstractions for MFAControllerInterface)
  • api-types.ts — ApiError (no SDK equivalent exists)
  • Added convention to AGENTS.md anti-patterns: "always re-export SDK types via type Alias = SDK.Type for API request/response shapes"

Packages

  • core
  • react

Testing

Please describe how this can be tested by reviewers. Be specific about anything not tested and reasons why. If this library has unit and tests should be added for new functionality and existing tests should complete without errors.

  • image
  • image

Checklist

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented Apr 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.42%. Comparing base (a5faee2) to head (c127d2b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #257   +/-   ##
=======================================
  Coverage   89.42%   89.42%           
=======================================
  Files         159      159           
  Lines       13325    13325           
  Branches     1435     1435           
=======================================
  Hits        11916    11916           
  Misses       1409     1409           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@harishsundar-okta harishsundar-okta added Gen AI Indicates that the most of the code in this PR were generated or assisted by generative AI tools. refactor Restructuring existing code and logic to reduce technical debt and improve quality labels Apr 20, 2026
…ctor/replace-custom-api-types-with-sdk-exports
@harishsundar-okta harishsundar-okta changed the title docs(core): add sdk re-export convention for api types refactor(core): add sdk re-export convention for api types Apr 21, 2026
@harishsundar-okta harishsundar-okta marked this pull request as ready for review April 21, 2026 05:28
…nto refactor/replace-custom-api-types-with-sdk-exports
Copy link
Copy Markdown
Contributor

@rax7389 rax7389 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pending Comment

@harishsundar-okta harishsundar-okta force-pushed the refactor/replace-custom-api-types-with-sdk-exports branch from 0bb7775 to c127d2b Compare May 6, 2026 09:53
@harishsundar-okta harishsundar-okta merged commit 41c6b47 into main May 6, 2026
6 checks passed
@harishsundar-okta harishsundar-okta deleted the refactor/replace-custom-api-types-with-sdk-exports branch May 6, 2026 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Gen AI Indicates that the most of the code in this PR were generated or assisted by generative AI tools. refactor Restructuring existing code and logic to reduce technical debt and improve quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants