Skip to content

fix(openapi): correct identity id type and document missing fields - #2653

Open
tsand wants to merge 4 commits into
supabase:masterfrom
tsand:fix/openapi-spec-defects
Open

tsand wants to merge 4 commits into
supabase:masterfrom
tsand:fix/openapi-spec-defects

Conversation

@tsand

@tsand tsand commented Jul 28, 2026 •

Copy link
Copy Markdown

What kind of change does this PR introduce?

Bug fix. Spec-only, no code changes.

What is the current behavior?

  • Identity id is typed format: uuid, but it holds the provider's subject. Generated clients fail to decode identities for every provider except email and phone.
  • The WebAuthn challenge discriminator targets inline oneOf arms, so it can never resolve.
  • current_password on PUT /user and POST /admin/users are undocumented.

What is the new behavior?

  • Identity id is a plain string.
  • The discriminator is removed. Each arm keeps its type enum, so clients can still branch on create vs request.
  • current_password is documented: required when GOTRUE_SECURITY_UPDATE_PASSWORD_REQUIRE_CURRENT_PASSWORD is on and the user has a password, except during recovery.
  • POST /admin/users is documented, including 422 for an already registered email or phone.

Additional context

Warning

Identity id becomes a string, so identity.Id.String() breaks the next time client/admin is regenerated. The UUID is still on identity_id.

client/admin is not regenerated here. Verified the admin client generates with the pinned oapi-codegen v2.8.0. No tests added.

https://claude.ai/code/session_01Evn2jxb2PeQQLzAUpN5pAN

@tsand
tsand requested a review from a team as a code owner July 28, 2026 13:50
@tsand
tsand force-pushed the fix/openapi-spec-defects branch from 7de116d to 473cec4 Compare July 28, 2026 13:51
@tsand
tsand force-pushed the fix/openapi-spec-defects branch from b7305b6 to 0a6361c Compare August 14, 2026 13:50
@tsand
tsand force-pushed the fix/openapi-spec-defects branch from 0a6361c to 4164e9e Compare September 22, 2026 19:50
The oneOf arms are inline schemas, so `propertyName: type` has no schema
name to resolve to and the discriminator never applied. Generators fail
with "discriminator: not all schemas were mapped". Each arm keeps its
`type` enum, so clients can still branch on create vs request.
IdentitySchema.id serializes models.Identity.ProviderID, the subject
issued by the external provider, not a UUID. Only the email and phone
providers use the user's ID there. Strict UUID parsing in generated
clients fails to deserialize identities from other providers.
UserUpdateParams accepts it, and the handler requires it when
Security.UpdatePasswordRequireCurrentPassword is enabled.
The endpoint is routed to adminUserCreate and documented in the README,
but was missing from the spec. AdminCreateUserSchema mirrors
AdminUserParams: UserSchema describes a response and cannot express
password, password_hash, email_confirm, phone_confirm or ban_duration,
so a client generated against it could not exercise the endpoint.
@tsand
tsand force-pushed the fix/openapi-spec-defects branch from 4164e9e to 76bd590 Compare September 22, 2026 20:25
@tsand tsand changed the title fix: unblock openapi code generation fix(openapi): correct identity id type and document missing fields Sep 22, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant