Skip to content

fix(parser): generate type-correct examples for auto-detected global headers#15094

Open
patrickthornton wants to merge 8 commits intomainfrom
patrick/parser/fix-global-header-example-type
Open

fix(parser): generate type-correct examples for auto-detected global headers#15094
patrickthornton wants to merge 8 commits intomainfrom
patrick/parser/fix-global-header-example-type

Conversation

@patrickthornton
Copy link
Copy Markdown
Contributor

@patrickthornton patrickthornton commented Apr 16, 2026

Summary

  • Auto-detected global headers now get type-correct placeholder examples instead of always using the header name as a string. Previously, buildEndpointExample generated PrimitiveExample.string("Request-Timeout") for every global header regardless of type, causing validation errors for non-string headers (integer, date, boolean, etc.).

Changed code

In buildEndpointExample.ts, the global header fallback now unwraps optional<>/nullable<> wrappers and dispatches on the inner type:

// Before: always string, always the header name
value: FullExample.primitive(PrimitiveExample.string(header))

// After: type-aware placeholder
value: FullExample.primitive(buildPrimitiveExampleForType(unwrapType(headerType), header))

Type mapping:

Header type Example value
integer / int 0
int64 / long 0
float / double 0.0
boolean true
date "2024-01-01"
datetime "2024-01-01T00:00:00Z"
string / unknown header name (existing behavior)

Test plan

  • fern check passes on projects with auto-detected integer global headers (e.g. Request-Timeout)
  • Existing behavior unchanged for string global headers
  • Unit test snapshots updated for date/datetime/string header examples
  • ETE header-overrides snapshot updated

🤖 Generated with Claude Code


Open with Devin

Copy link
Copy Markdown

@claude claude bot left a comment

Choose a reason for hiding this comment

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

Claude Code Review

This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.

Tip: disable this comment in your organization's Code Review settings.

@patrickthornton patrickthornton self-assigned this Apr 16, 2026
@github-actions
Copy link
Copy Markdown
Contributor

🌱 Seed Test Selector

Select languages to run seed tests for:

  • Python
  • TypeScript
  • Java
  • Go
  • Ruby
  • C#
  • PHP
  • Swift
  • Rust
  • OpenAPI

How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

SDK Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-16T05:00:10Z).

Full benchmark table (click to expand)
Generator Spec main (generator) main (E2E) PR (generator) Delta
csharp-sdk square 97s 132s 41s -56s (-57.7%)
go-sdk square 114s 150s 56s -58s (-50.9%)
java-sdk square 165s 205s 118s -47s (-28.5%)
php-sdk square 97s 129s 40s -57s (-58.8%)
python-sdk square 114s 149s 63s -51s (-44.7%)
ruby-sdk-v2 square 122s 150s 69s -53s (-43.4%)
rust-sdk square 100s 96s 51s -49s (-49.0%)
swift-sdk square 87s 127s 40s -47s (-54.0%)
ts-sdk square 104s 137s 50s -54s (-51.9%)

main (generator): generator-only time via --skip-scripts (includes Docker image build, container startup, IR parsing, and code generation — this is the same Docker-based flow customers use via fern generate). main (E2E): full customer-observable time including build/test scripts (nightly baseline, informational). Delta is computed against generator-only baseline.
⚠️ = generation exited with a non-zero exit code (timing may not reflect a successful run).
Baseline from nightly runs on main (latest: 2026-04-16T05:00:10Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-17 03:37 UTC

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 16, 2026

Docs Generation Benchmark Results

Comparing PR branch against latest nightly baseline on main (2026-04-16T05:00:10Z).

Fixture main PR Delta
docs 301.0s 289.2s (35 versions) -11.8s (-3.9%)

Docs generation runs fern generate --docs --preview end-to-end against the benchmark fixture with 35 API versions (each version: markdown processing + OpenAPI-to-IR + FDR upload).
Delta is computed against the nightly baseline on main.
Baseline from nightly run(s) on main (latest: 2026-04-16T05:00:10Z). Trigger benchmark-baseline to refresh.
Last updated: 2026-04-17 03:38 UTC

@fern-support fern-support changed the title fix(cli): skip example generation for auto-detected global headers without endpoint examples fix(cli): generate type-correct examples for auto-detected global headers Apr 16, 2026
@fern-support fern-support changed the title fix(cli): generate type-correct examples for auto-detected global headers fix(parser): generate type-correct examples for auto-detected global headers Apr 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants