Skip to content

spike(codegen): Smithy → OpenAPI → swift-openapi-generator pipeline for Storage + Functions#1047

Draft
grdsdev wants to merge 32 commits into
release/v3from
claude/loving-dhawan-8efb40
Draft

spike(codegen): Smithy → OpenAPI → swift-openapi-generator pipeline for Storage + Functions#1047
grdsdev wants to merge 32 commits into
release/v3from
claude/loving-dhawan-8efb40

Conversation

@grdsdev

@grdsdev grdsdev commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

DO NOT MERGE — Spike / Proof of Concept

Summary

This is an exploratory spike proving the full Smithy IDL → OpenAPI → swift-openapi-generator codegen pipeline for the Storage and Functions clients.

  • Adds Smithy models for Storage and Functions under codegen/
  • Generates OpenAPI specs and Swift clients via make codegen
  • Wires Storage bucket operations (listBuckets, getBucket, createBucket, deleteBucket, updateBucket, emptyBucket) to the generated client
  • Wires Functions invoke to the generated client
  • Adds SupabaseMiddleware (ClientMiddleware) to consolidate static header injection (apikey, X-Client-Info) and dynamic Bearer token injection
  • Closes the x-relay-error on genuine 200 detection gap via RelayErrorMiddleware (in progress)

Status

Work in progress — middleware wiring for Functions not yet complete. The branch is being developed iteratively.

Known limitations / out of scope

  • Fabricated HTTPURLResponse on the Functions generated path (no real response headers exposed) — structural change required, deferred
  • Not all Storage operations are wired yet — bucket ops only

Test plan

  • Storage generated client tests pass
  • Functions generated client tests pass
  • SupabaseMiddleware unit tests pass (5 tests)
  • Full test suite passes on CI

grdsdev added 16 commits June 27, 2026 14:07
…odels

- Fix storage.smithy: remove @httpPayload from list members (AWS restJson1
  constraint), add @idempotent to PUT/DELETE operations, suppress
  UnexpectedPayload danger for DeleteObjects
- Update Makefile generate-smithy to copy build output to smithy/output/openapi/
- Update Makefile to use ~/bin/swift-openapi-generator (built from source)
- Add openapi-generator-config.yaml for Storage and Functions
- Generate StorageService.openapi.json and FunctionsService.openapi.json
- Generate Sources/Storage/Generated/{Types,Client}.swift
- Generate Sources/Functions/Generated/{Types,Client}.swift

Build currently fails with "multiple producers" for Types.swift — existing
Types.swift in each module conflicts with generated Types.swift; resolved
in Task 4/5 when Package.swift targets are restructured.
- Add package init accepting ClientTransport for testing
- Delegate listBuckets/getBucket/createBucket/updateBucket/emptyBucket/deleteBucket to generated Client
- Add BucketConversions.swift for Bucket ↔ generated schema conversion
- Add MockTransport for unit testing generated client integration
- Add StorageClientGeneratedTests with Swift Testing
- Add OpenAPIURLSession to Storage target, OpenAPIRuntime to StorageTests target
- Remove @_spi(Generated) from MockTransport — ClientTransport is public API
- Extract normalizeClientInfoHeaders and resolveStorageURL static helpers to
  eliminate ~60 lines of duplication between the two package inits
- Promote supabase host regex to a static let to avoid repeated compilation
- Remove dead #if canImport(Darwin) block (both branches were identical)
- Add ISO8601DateFormatter as nonisolated(unsafe) static let in BucketConversions
- Add owner:"" comment explaining why the field is absent from generated schema
- Add storageError(statusCode:body:) helper; update all .undocumented handlers
  to extract body detail for more informative error messages
- Add Swift Testing tests for getBucket, createBucket, updateBucket, emptyBucket,
  and deleteBucket (happy path + error path each)
…e config YAMLs

Replace bare URLSessionTransport with SupabaseClientTransport in the
production StorageClient init so that Authorization headers are injected
from the token provider. Also exclude openapi-generator-config.yaml from
the Storage and Functions SPM targets to eliminate unhandled-file warnings.
@grdsdev grdsdev changed the base branch from main to release/v3 June 30, 2026 13:08
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

⚠️ Potential Breaking API Changes Detected

This PR appears to contain breaking API changes. Please review the changes below:

API Check Output
** Checking required environment variables...
** Fetching baseline: https://github.com/supabase/supabase-swift.git#release/v3...
From https://github.com/supabase/supabase-swift
 * branch            release/v3 -> FETCH_HEAD
** Checking for API changes since https://github.com/supabase/supabase-swift.git#release/v3 (811d2f1acfe6da61a97a4752e7e52a5c79c86dac)...
Fetching https://github.com/mattt/Replay.git
Fetching https://github.com/apple/swift-collections
[1/711] Fetching replay
[712/25983] Fetching replay, swift-collections
Fetched https://github.com/mattt/Replay.git from cache (1.64s)
Fetched https://github.com/apple/swift-collections from cache (1.64s)
Fetching https://github.com/apple/swift-argument-parser.git
Fetching https://github.com/pointfreeco/swift-concurrency-extras
[1/1039] Fetching swift-concurrency-extras
Fetched https://github.com/pointfreeco/swift-concurrency-extras from cache (0.61s)
Fetching https://github.com/apple/swift-http-types
[1/17949] Fetching swift-argument-parser
[17950/19168] Fetching swift-argument-parser, swift-http-types
Fetched https://github.com/apple/swift-argument-parser.git from cache (1.12s)
[37/1219] Fetching swift-http-types
Fetching https://github.com/apple/swift-openapi-urlsession
Fetched https://github.com/apple/swift-http-types from cache (0.59s)
Fetching https://github.com/pointfreeco/swift-custom-dump
[1/1168] Fetching swift-openapi-urlsession
Fetched https://github.com/apple/swift-openapi-urlsession from cache (0.56s)
Fetching https://github.com/pointfreeco/xctest-dynamic-overlay
[1/5609] Fetching swift-custom-dump
Fetched https://github.com/pointfreeco/swift-custom-dump from cache (0.77s)
Fetching https://github.com/swiftlang/swift-syntax
[1/5891] Fetching xctest-dynamic-overlay
Fetched https://github.com/pointfreeco/xctest-dynamic-overlay from cache (1.00s)
Fetching https://github.com/pointfreeco/swift-snapshot-testing
[1/75791] Fetching swift-syntax
[58361/91964] Fetching swift-syntax, swift-snapshot-testing
Fetched https://github.com/pointfreeco/swift-snapshot-testing from cache (3.55s)
Fetching https://github.com/apple/swift-asn1.git
[1/1914] Fetching swift-asn1
Fetched https://github.com/apple/swift-asn1.git from cache (1.78s)
Fetching https://github.com/pointfreeco/swift-clocks
Fetched https://github.com/swiftlang/swift-syntax from cache (6.11s)
Fetching https://github.com/apple/swift-crypto.git
[1/1416] Fetching swift-clocks
Fetched https://github.com/pointfreeco/swift-clocks from cache (0.68s)
Fetching https://github.com/apple/swift-openapi-runtime
[1/17783] Fetching swift-crypto
[8715/24493] Fetching swift-crypto, swift-openapi-runtime
Fetched https://github.com/apple/swift-openapi-runtime from cache (0.81s)
Fetching https://github.com/WeTransfer/Mocker
Fetched https://github.com/apple/swift-crypto.git from cache (1.92s)
[1/1889] Fetching mocker
Fetched https://github.com/WeTransfer/Mocker from cache (0.66s)
Computing version for https://github.com/apple/swift-openapi-urlsession
Computed https://github.com/apple/swift-openapi-urlsession at 1.3.1 (12.91s)
Computing version for https://github.com/apple/swift-openapi-runtime
Computed https://github.com/apple/swift-openapi-runtime at 1.12.0 (0.46s)
Computing version for https://github.com/mattt/Replay.git
Computed https://github.com/mattt/Replay.git at 0.4.0 (0.37s)
Fetching https://github.com/swift-server/async-http-client.git
[1/15999] Fetching async-http-client
Fetched https://github.com/swift-server/async-http-client.git from cache (1.39s)
Computing version for https://github.com/WeTransfer/Mocker
Computed https://github.com/WeTransfer/Mocker at 3.0.2 (5.22s)
Computing version for https://github.com/pointfreeco/xctest-dynamic-overlay
Computed https://github.com/pointfreeco/xctest-dynamic-overlay at 1.9.0 (0.42s)
Computing version for https://github.com/pointfreeco/swift-snapshot-testing
Computed https://github.com/pointfreeco/swift-snapshot-testing at 1.18.9 (0.40s)
Computing version for https://github.com/pointfreeco/swift-custom-dump
Computed https://github.com/pointfreeco/swift-custom-dump at 1.6.0 (0.52s)
Computing version for https://github.com/pointfreeco/swift-concurrency-extras
Computed https://github.com/pointfreeco/swift-concurrency-extras at 1.3.2 (0.53s)
Computing version for https://github.com/pointfreeco/swift-clocks
Computed https://github.com/pointfreeco/swift-clocks at 1.0.6 (0.53s)
Computing version for https://github.com/apple/swift-http-types.git
Computed https://github.com/apple/swift-http-types.git at 1.3.1 (0.66s)
Computing version for https://github.com/apple/swift-crypto.git
Computed https://github.com/apple/swift-crypto.git at 4.5.0 (1.08s)
Computing version for https://github.com/apple/swift-collections
Computed https://github.com/apple/swift-collections at 1.6.0 (0.54s)
Computing version for https://github.com/apple/swift-argument-parser.git
Computed https://github.com/apple/swift-argument-parser.git at 1.7.1 (0.37s)
Computing version for https://github.com/swiftlang/swift-syntax
Computed https://github.com/swiftlang/swift-syntax at 600.0.1 (0.65s)
Computing version for https://github.com/apple/swift-asn1.git
Computed https://github.com/apple/swift-asn1.git at 1.3.1 (0.64s)
Computing version for https://github.com/swift-server/async-http-client.git
Computed https://github.com/swift-server/async-http-client.git at 1.34.0 (0.45s)
Fetching https://github.com/apple/swift-algorithms.git
Fetching https://github.com/apple/swift-distributed-tracing.git
[1/5857] Fetching swift-distributed-tracing
[2/11927] Fetching swift-distributed-tracing, swift-algorithms
Fetched https://github.com/apple/swift-algorithms.git from cache (0.74s)
Fetched https://github.com/apple/swift-distributed-tracing.git from cache (0.75s)
Fetching https://github.com/apple/swift-atomics.git
Fetching https://github.com/apple/swift-log.git
[1/1868] Fetching swift-atomics
Fetched https://github.com/apple/swift-atomics.git from cache (0.68s)
Fetching https://github.com/apple/swift-nio-transport-services.git
[1/2860] Fetching swift-nio-transport-services
Fetched https://github.com/apple/swift-nio-transport-services.git from cache (0.76s)
Fetching https://github.com/apple/swift-nio-extras.git
[1/7604] Fetching swift-log
Fetched https://github.com/apple/swift-log.git from cache (1.73s)
Fetching https://github.com/apple/swift-nio-http2.git
[1/6550] Fetching swift-nio-extras
Fetched https://github.com/apple/swift-nio-extras.git from cache (0.77s)
Fetching https://github.com/apple/swift-nio-ssl.git
[1/12156] Fetching swift-nio-http2
[12157/27736] Fetching swift-nio-http2, swift-nio-ssl
Fetched https://github.com/apple/swift-nio-http2.git from cache (1.35s)
[3272/15580] Fetching swift-nio-ssl
Fetching https://github.com/apple/swift-nio.git
Fetched https://github.com/apple/swift-nio-ssl.git from cache (1.62s)
[1/84165] Fetching swift-nio
Fetched https://github.com/apple/swift-nio.git from cache (5.08s)
Computing version for https://github.com/apple/swift-distributed-tracing.git
Computed https://github.com/apple/swift-distributed-tracing.git at 1.4.1 (9.44s)
Fetching https://github.com/apple/swift-service-context.git
[1/1301] Fetching swift-service-context
Fetched https://github.com/apple/swift-service-context.git from cache (0.54s)
Computing version for https://github.com/apple/swift-algorithms.git
Computed https://github.com/apple/swift-algorithms.git at 1.2.1 (1.10s)
Fetching https://github.com/apple/swift-numerics.git
[1/6441] Fetching swift-numerics
Fetched https://github.com/apple/swift-numerics.git from cache (0.78s)
Computing version for https://github.com/apple/swift-nio.git
Computed https://github.com/apple/swift-nio.git at 2.101.2 (1.38s)
Fetching https://github.com/apple/swift-system.git
[1/5941] Fetching swift-system
Fetched https://github.com/apple/swift-system.git from cache (0.78s)
Computing version for https://github.com/apple/swift-atomics.git
Computed https://github.com/apple/swift-atomics.git at 1.3.1 (1.16s)
Computing version for https://github.com/apple/swift-service-context.git
Computed https://github.com/apple/swift-service-context.git at 1.3.0 (0.33s)
Computing version for https://github.com/apple/swift-numerics.git
Computed https://github.com/apple/swift-numerics.git at 1.1.1 (0.34s)
Computing version for https://github.com/apple/swift-nio-transport-services.git
Computed https://github.com/apple/swift-nio-transport-services.git at 1.28.0 (0.36s)
Computing version for https://github.com/apple/swift-nio-http2.git
Computed https://github.com/apple/swift-nio-http2.git at 1.44.0 (0.36s)
Computing version for https://github.com/apple/swift-nio-ssl.git
Computed https://github.com/apple/swift-nio-ssl.git at 2.37.1 (0.37s)
Computing version for https://github.com/apple/swift-log.git
Computed https://github.com/apple/swift-log.git at 1.14.0 (0.36s)
Computing version for https://github.com/apple/swift-system.git
Computed https://github.com/apple/swift-system.git at 1.7.2 (0.39s)
Computing version for https://github.com/apple/swift-nio-extras.git
Computed https://github.com/apple/swift-nio-extras.git at 1.34.1 (0.41s)
Fetching https://github.com/swift-server/swift-service-lifecycle.git
Fetching https://github.com/apple/swift-async-algorithms.git
[1/2770] Fetching swift-service-lifecycle
[2771/9354] Fetching swift-service-lifecycle, swift-async-algorithms
Fetched https://github.com/swift-server/swift-service-lifecycle.git from cache (0.62s)
[132/6584] Fetching swift-async-algorithms
Fetching https://github.com/apple/swift-certificates.git
Fetched https://github.com/apple/swift-async-algorithms.git from cache (0.80s)
Fetching https://github.com/apple/swift-http-structured-headers.git
[1/7349] Fetching swift-certificates
[1471/8598] Fetching swift-certificates, swift-http-structured-headers
Fetched https://github.com/apple/swift-http-structured-headers.git from cache (0.57s)
Fetched https://github.com/apple/swift-certificates.git from cache (0.77s)
Computing version for https://github.com/swift-server/swift-service-lifecycle.git
Computed https://github.com/swift-server/swift-service-lifecycle.git at 2.11.0 (1.82s)
Computing version for https://github.com/apple/swift-async-algorithms.git
Computed https://github.com/apple/swift-async-algorithms.git at 1.1.5 (0.55s)
Computing version for https://github.com/apple/swift-http-structured-headers.git
Computed https://github.com/apple/swift-http-structured-headers.git at 1.7.0 (0.41s)
Computing version for https://github.com/apple/swift-certificates.git
Computed https://github.com/apple/swift-certificates.git at 1.19.2 (0.51s)
Creating working copy for https://github.com/apple/swift-openapi-runtime
Working copy of https://github.com/apple/swift-openapi-runtime resolved at 1.12.0
Creating working copy for https://github.com/apple/swift-numerics.git
Working copy of https://github.com/apple/swift-numerics.git resolved at 1.1.1
Creating working copy for https://github.com/apple/swift-distributed-tracing.git
Working copy of https://github.com/apple/swift-distributed-tracing.git resolved at 1.4.1
Creating working copy for https://github.com/apple/swift-algorithms.git
Working copy of https://github.com/apple/swift-algorithms.git resolved at 1.2.1
Creating working copy for https://github.com/apple/swift-service-context.git
Working copy of https://github.com/apple/swift-service-context.git resolved at 1.3.0
Creating working copy for https://github.com/swift-server/swift-service-lifecycle.git
Working copy of https://github.com/swift-server/swift-service-lifecycle.git resolved at 2.11.0
Creating working copy for https://github.com/swiftlang/swift-syntax
Working copy of https://github.com/swiftlang/swift-syntax resolved at 600.0.1
Creating working copy for https://github.com/apple/swift-system.git
Working copy of https://github.com/apple/swift-system.git resolved at 1.7.2
Creating working copy for https://github.com/apple/swift-openapi-urlsession
Working copy of https://github.com/apple/swift-openapi-urlsession resolved at 1.3.1
Creating working copy for https://github.com/apple/swift-http-types
Working copy of https://github.com/apple/swift-http-types resolved at 1.3.1
Creating working copy for https://github.com/apple/swift-nio-http2.git
Working copy of https://github.com/apple/swift-nio-http2.git resolved at 1.44.0
Creating working copy for https://github.com/pointfreeco/swift-custom-dump
Working copy of https://github.com/pointfreeco/swift-custom-dump resolved at 1.6.0
Creating working copy for https://github.com/apple/swift-atomics.git
Working copy of https://github.com/apple/swift-atomics.git resolved at 1.3.1
Creating working copy for https://github.com/pointfreeco/swift-clocks
Working copy of https://github.com/pointfreeco/swift-clocks resolved at 1.0.6
Creating working copy for https://github.com/apple/swift-log.git
Working copy of https://github.com/apple/swift-log.git resolved at 1.14.0
Creating working copy for https://github.com/swift-server/async-http-client.git
Working copy of https://github.com/swift-server/async-http-client.git resolved at 1.34.0
Creating working copy for https://github.com/pointfreeco/xctest-dynamic-overlay
Working copy of https://github.com/pointfreeco/xctest-dynamic-overlay resolved at 1.9.0
Creating working copy for https://github.com/apple/swift-async-algorithms.git
Working copy of https://github.com/apple/swift-async-algorithms.git resolved at 1.1.5
Creating working copy for https://github.com/apple/swift-argument-parser.git
Working copy of https://github.com/apple/swift-argument-parser.git resolved at 1.7.1
Creating working copy for https://github.com/apple/swift-collections
Working copy of https://github.com/apple/swift-collections resolved at 1.6.0
Creating working copy for https://github.com/WeTransfer/Mocker
Working copy of https://github.com/WeTransfer/Mocker resolved at 3.0.2
Creating working copy for https://github.com/apple/swift-nio-extras.git
Working copy of https://github.com/apple/swift-nio-extras.git resolved at 1.34.1
Creating working copy for https://github.com/pointfreeco/swift-snapshot-testing
Working copy of https://github.com/pointfreeco/swift-snapshot-testing resolved at 1.18.9
Creating working copy for https://github.com/apple/swift-asn1.git
Working copy of https://github.com/apple/swift-asn1.git resolved at 1.3.1
Creating working copy for https://github.com/mattt/Replay.git
Working copy of https://github.com/mattt/Replay.git resolved at 0.4.0
Creating working copy for https://github.com/apple/swift-http-structured-headers.git
Working copy of https://github.com/apple/swift-http-structured-headers.git resolved at 1.7.0
Creating working copy for https://github.com/apple/swift-nio.git
Working copy of https://github.com/apple/swift-nio.git resolved at 2.101.2
Creating working copy for https://github.com/apple/swift-nio-ssl.git
Working copy of https://github.com/apple/swift-nio-ssl.git resolved at 2.37.1
Creating working copy for https://github.com/apple/swift-certificates.git
Working copy of https://github.com/apple/swift-certificates.git resolved at 1.19.2
Creating working copy for https://github.com/pointfreeco/swift-concurrency-extras
Working copy of https://github.com/pointfreeco/swift-concurrency-extras resolved at 1.3.2
Creating working copy for https://github.com/apple/swift-crypto.git
Working copy of https://github.com/apple/swift-crypto.git resolved at 4.5.0
Creating working copy for https://github.com/apple/swift-nio-transport-services.git
Working copy of https://github.com/apple/swift-nio-transport-services.git resolved at 1.28.0
warning: 'supabase-swift': found 1 file(s) which are unhandled; explicitly declare them as resources or exclude from the target
    /Users/runner/work/supabase-swift/supabase-swift/Sources/PostgREST/openapi-generator-config.yaml
[1/1] Compiling plugin ReplayPlugin
[2/2] Compiling plugin GenerateManual
[3/3] Compiling plugin GenerateDoccReference
Building for debugging...
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/Functions.build/Client.swift.o because of multiple producers: Compiling Swift Module 'Functions' (8 sources), Compiling Swift Module 'Functions' (8 sources)
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/Functions.build/Types.swift.o because of multiple producers: Compiling Swift Module 'Functions' (8 sources), Compiling Swift Module 'Functions' (8 sources)
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/PostgREST.build/Client.swift.o because of multiple producers: Compiling Swift Module 'PostgREST' (13 sources), Compiling Swift Module 'PostgREST' (13 sources)
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/PostgREST.build/Types.swift.o because of multiple producers: Compiling Swift Module 'PostgREST' (13 sources), Compiling Swift Module 'PostgREST' (13 sources), Compiling Swift Module 'PostgREST' (13 sources)
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/Storage.build/Client.swift.o because of multiple producers: Compiling Swift Module 'Storage' (17 sources), Compiling Swift Module 'Storage' (17 sources)
error: couldn't build /Users/runner/work/supabase-swift/supabase-swift/.build/arm64-apple-macosx/debug/Storage.build/Types.swift.o because of multiple producers: Compiling Swift Module 'Storage' (17 sources), Compiling Swift Module 'Storage' (17 sources)
error: fatalError
** ERROR: ❌ Breaking API changes detected.

If this is intentional, please update your PR title or commit message to include:

  • ! after the type (e.g., feat!: remove deprecated method)
  • Or include BREAKING CHANGE: in the commit body

If this is a false positive, you can safely ignore this warning.

grdsdev added 5 commits June 30, 2026 10:44
Replace MultipartUploadEngine.makeTask in upload/update methods with
direct calls to client.generatedClient.UploadObject / UpdateObject.
Replace hand-rolled URLRequest HTTP in TUSUploadEngine with
CreateTusUpload / GetUploadOffset / UploadChunk generated operations.
Delete the spike helper file StorageFileApi+GeneratedUpload.swift.
Remove the hand-written _HTTPClient path from FunctionsClient.
Both invoke() and invokeStream() now go exclusively through the
generated InvokeFunction operation.

invokeStream() bridges the HTTPBody AsyncSequence from the generated
response body to AsyncThrowingStream<UInt8> with no intermediate
buffering — bytes are forwarded chunk-by-chunk as they arrive.

Spike limitations (documented in class-level doc comment):
- POST-only: FunctionInvokeOptions.method / .query not forwarded
- HTTPURLResponse is fabricated (status code only, no headers)
…peration Smithy model

Smithy requires a fixed HTTP method per operation, so we model all five
methods Supabase Edge Functions accept as separate operations on the same
path. FunctionsClient.invoke() and invokeStream() now dispatch to the
appropriate generated method based on FunctionInvokeOptions.method.

Generated Types.swift shares InvokeFunctionOutput and
InvokeFunctionBodyInput across POST/PUT/PATCH/DELETE to avoid duplication.
GET gets its own input type (no body — Smithy rejects @httpPayload on GET).

The invokeGeneratedClient() helper centralises the dispatch switch so
both invoke() and invokeStream() stay focused on response handling.
grdsdev added 2 commits July 1, 2026 06:46
…odel

- Rewrite Makefile to use sync-models target pulling pre-built OpenAPI
  artifacts from supabase/sdk instead of maintaining local Smithy models
- Add generate-swift-postgrest target and PostgREST openapi-generator-config
- Add DatabaseService.openapi.json to spike's output/openapi/
- Commit generated Client.swift (912 lines) and Types.swift (2057 lines)
  for the PostgREST database service

Key finding: the @httpQueryParams StringMap for `filters` is emitted as a
single named query param "filters" by Smithy → OpenAPI, then serialized as
one param by swift-openapi-generator. PostgREST requires each filter key to
be its own query param (?id=eq.5&name=like.*foo*). This confirms the
transport layer (path, method, fixed params, headers, body, Content-Range)
is fully codegen-able; only the query-builder that populates the filter map
stays hand-written — which was already the design intent.
…in supabase/sdk)

Generated from typespec/openapi artifacts in supabase/sdk PR #53 for
side-by-side comparison against the Smithy-generated clients.

Line counts:
  Storage:   1376+3963 = 5339 (Smithy: 1773+4729 = 6502)
  Functions:  494+1134 = 1628 (Smithy:  253+ 290 =  543)
  PostgREST:  745+1724 = 2469 (Smithy:  912+2057 = 2969)
  Total:               = 9436 (Smithy:            = 10014)
grdsdev added 6 commits July 1, 2026 08:42
…c model

Updated postgrest.tsp in supabase/sdk (commit 720bc1d) splits named fixed
params from the dynamic filters map. Changes in generated output:

- select, order, limit (Swift.Int), offset (Swift.Int) are now separate
  typed members on each table operation query struct
- filters: filtersPayload (additionalProperties[String:String]) is its own
  member, not mixed with fixed params
- FilterOperator enum (24 operators) generated from TypeSpec enum
- RpcOperations_rpcGet added as a separate GET operation for RPC
- 2969→3107 lines (TypeSpec now matches Smithy coverage)
…fixed TypeSpec models

Storage: Objects_upload (POST) and Objects_update (PUT) now generated with
native multipart/form-data bodies (cacheControl + file parts) — no patch
script needed. Smithy required patch-openapi.py to inject these manually.

PostgREST: select/order/limit(Int)/offset(Int) are separate typed query
members; filters is a separate additionalProperties map; FilterOperator enum
and RpcOperations_rpcGet are present.

Storage line count: 1376→1646 Client + 3963→4443 Types (multipart added)
All remaining gaps from initial comparison are now closed.
…equest bodies

Follows supabase/sdk commit 3cd468b. Replaces OpenAPIValueContainer (any-JSON)
with HTTPBody (streaming binary) on all response and request bodies — now
identical to the Smithy-generated output in this respect.
…ected body types

Functions invoke Body enum now has four cases:
  .json(OpenAPIValueContainer)   — application/json
  .binary(HTTPBody)              — application/octet-stream
  .plainText(HTTPBody)           — text/plain
  .urlEncodedForm(String)        — application/x-www-form-urlencoded

PostgREST request body reverted to .json(OpenAPIValueContainer) since PostgREST
accepts JSON row arrays/objects; response body stays .binary(HTTPBody) so the
SDK layer decodes into the caller's Decodable type.
… body

Response Body enum now has three cases matching the response content-type:
  .json(OpenAPIValueContainer)  — application/json
  .binary(HTTPBody)             — application/octet-stream
  .plainText(HTTPBody)          — text/plain

Request Body enum unchanged (json/binary/plainText/urlEncodedForm).
…/* content type)

Replace the @SharedRoute multi-variant approach with a single operation per
HTTP method. Both request body and response body are now HTTPBody (case any),
generic enough for any content type: JSON, binary, text, event-stream, etc.
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