fix(cli): decode sso providers when saml id/entity_id are absent#5479
Open
Coly010 wants to merge 1 commit into
Open
fix(cli): decode sso providers when saml id/entity_id are absent#5479Coly010 wants to merge 1 commit into
Coly010 wants to merge 1 commit into
Conversation
The native `sso list` port (v2.102.0) decodes Management API responses with a strict Effect Schema generated from the OpenAPI spec. The spec over-declares the SSO provider `saml` descriptor as `required: ["id", "entity_id"]`, but the list/get responses omit `saml.id` (and can omit `entity_id`), so decoding failed with `SchemaError(Missing key at ["items"][0]["saml"]["id"])`. The Go CLI tolerated this via `encoding/json`. Relax the `saml` descriptor's required fields for the five SSO provider response schemas in the codegen (`generate.ts`) and mirror the change in the committed `contracts.ts`/`openapi.json`. Request bodies stay strict. Fixes #5475
Supabase CLI previewnpx --yes https://pkg.pr.new/supabase@5479Preview package for commit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
supabase sso list(andsso show) failed on v2.102.0+ with:When
sso listwas ported to a native TS handler in v2.102.0, it began decoding Management API responses with a strict Effect Schema generated from the OpenAPI spec. The spec over-declares the SSO providersamldescriptor as"required": ["id", "entity_id"], but the realGET /v1/projects/{ref}/config/auth/sso/providersresponse omitssaml.id(and can omitentity_id). Strict decoding therefore rejected a well-formed response. The Go CLI usedencoding/json, which silently tolerates missing fields — hence ≤2.101.0 worked.Why this way
packages/api/scripts/generate.ts): a documented spec-normalization step relaxes thesamldescriptor'srequiredfields for the five SSO provider response schemas (Create/List/Get/Update/DeleteProviderResponse). Request bodies stay strict. This mirrors the existing UUID-pattern patch precedent.contracts.ts/openapi.json(5 saml blocks). A full regen was not used because the committed generated files carry large pre-existing toolchain drift, which would bury this fix in an unrelated diff.saml.idand already treats everysamlfield as optional, so there is no downstream type impact.A regression test in
list.integration.test.tsreturns a provider whosesamlomitsid/entity_idand asserts the command renders — it reproduces the exact error without the schema change.Follow-up worth filing separately: the upstream Management API OpenAPI spec should not mark
saml.id/entity_idas required on these responses.Fixes #5475