Skip to content

Fix SDK generator issues found in release reviews#1670

Merged
ChiragAgg5k merged 5 commits into
mainfrom
fix/sdk-release-review-feedback
Jul 13, 2026
Merged

Fix SDK generator issues found in release reviews#1670
ChiragAgg5k merged 5 commits into
mainfrom
fix/sdk-release-review-feedback

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

  • address actionable Greptile feedback found across the 16 SDK release PRs
  • emit OAuth bearer credentials consistently while preserving raw SDK configuration values
  • harden generated Python optional parameters and Swift optional nested model decoding
  • clean up generated Kotlin, Dart, Web, and Unity output identified during release review

Test plan

  • composer lint
  • vendor/bin/phpunit --testsuite Unit (33 tests, 124 assertions)
  • composer refactor:check
  • composer lint-twig
  • regenerate all 16 affected SDK examples from the shared local fixture
  • run targeted generated SDK compiler, parser, and formatter checks

@greptile-apps

greptile-apps Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR addresses a batch of SDK generator correctness issues identified during 16 SDK release reviews. It consistently prepends "Bearer " to OAuth token headers across all 14 language templates while keeping raw values in the config store, and hardens null-safety in generated Kotlin, Swift, Ruby, Dart, and Python code for optional nested models and parameters.

  • Bearer credential emission: all client templates now emit "Bearer <value>" for type: bearer headers; config stores the raw token so callers can still read it back via get_config.
  • Null-safety hardening: Kotlin generator adds as?/?. for optional sub_schema arrays and maps; Swift extends nil-guarded decode to all non-required nested models; Ruby uses &. safe navigation; Dart wraps optional sub_schema in null ternaries; Python drops the incorrect not parameter.nullable extra guard so optional-nullable params are only emitted when not None.
  • Web realtime: a new else branch in web/src/client.ts.twig sends session authentication on the connected event for all non-console SDK platforms, which previously had no realtime auth at all.

Confidence Score: 5/5

Safe to merge — all changes are targeted bug fixes with accompanying test fixture updates and no new logic paths that could regress existing behaviour.

Every template change is a direct, narrow correction (add Bearer prefix, add null guard, fix optional condition). The Python params fix removes an erroneous double condition; the Kotlin generator correctly drops the redundant ?: null suffix; the Unity impersonation key normalisation is consistent with the lowercase convention used everywhere else in that template. Test coverage was extended in lockstep with the spec additions.

No files require special attention.

Important Files Changed

Filename Overview
src/SDK/Language/Kotlin.php Hardens null-safety for optional sub_schema and enum properties: safe-casts optional arrays/maps and removes the redundant ?: null suffix on find() which already returns null when nothing matches.
templates/python/base/params.twig Fixes optional parameter guard: drops the extra not parameter.nullable condition so nullable-but-optional params are wrapped in if ... is not None rather than always emitted.
templates/web/src/client.ts.twig Extends realtime session authentication to non-console platforms; console path keeps shouldUseFallbackCredentials guard, new else branch sends auth unconditionally (when session exists) for regular web SDK clients.
templates/unity/Assets/Runtime/Core/Client.cs.twig Normalises impersonation config keys to lowercase to match the caseLower convention used by the global header loop; bearer headers now get explicit config+header split.
templates/swift/Sources/Models/Model.swift.twig Extends the nil-guarded decode path to all non-required nested model properties, preventing force-cast crashes on optional fields.
templates/ruby/lib/container/models/model.rb.twig Adds safe-navigation &. for optional sub_schema array/scalar from/to_map calls; required properties retain the plain . call.
templates/dart/lib/src/models/model.dart.twig Wraps non-required sub_schema fields with a null-ternary guard for both array and object properties.
templates/rust/src/client.rs.twig Bearer headers now emit format!("Bearer {}", value) into config.headers; consistent with the existing Rust Client design which has no separate raw-value config map.
templates/python/package/client.py.twig Bearer headers now use 'Bearer ' + value in _global_headers; raw value is still stored in _config, preserving the standard two-store pattern.
tests/resources/spec-openapi3.json Adds Bearer security scheme, optionalNullable query param, and relatedMock optional nested model to test fixtures.
tests/unit/OpenAPI3SpecTest.php Extends testGlobalHeadersComeFromSecuritySchemes to assert the Bearer scheme is emitted as a global header with type=bearer and global=true.

Reviews (3): Last reviewed commit: "fix: decode optional Kotlin model proper..." | Re-trigger Greptile

Comment thread templates/python/package/client.py.twig Outdated
@ChiragAgg5k ChiragAgg5k merged commit e6d55c0 into main Jul 13, 2026
58 checks passed
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