(feat): Add a dedupeUnionBaseProperties config option (default false). When enabled, a
discriminated union no longer emits a duplicate top-level field for base properties
that every variant already carries (e.g. properties lifted from a shared parent by
infer-discriminated-union-base-properties). Without it, such a property appears both
on the union and inside each variant struct, and the top-level copy is silently
dropped when marshaling samePropertiesAsObject variants. With the flag on, the
shared property is exposed through a getter that switches on the discriminant and reads
from the active variant — a single source of truth that still allows top-level access
without a type switch. The flag is opt-in to preserve the existing generated surface;
the default will flip in a future major version with a migration.
(fix): Fix compile errors in generated Go SDKs where the v2/ TypeScript client,
its generated tests, and the generated dynamic snippet tests referenced
types in their original package after the v1 generator had relocated those
leaf types into the shared common package to break an import cycle. The v1
generator now records the relocations in a sidecar that the v2 generator
reads, and also writes them to a host-readable file (when the Fern CLI asks
for it) so the CLI’s dynamic snippet test generator references the relocated
types from the same package too.
(fix): Fix generated Go failing to compile when an undiscriminated union is sent as
a request header. Such unions now generate a String() method (fmt.Stringer)
and the client serializes the header via that method, instead of passing the
union struct where a string is expected.
(fix): Fixed pagination for endpoints whose results property is a named alias to a
list or set (e.g. results: $response.data where data is a UserList
alias). Previously v1 generation aborted with “unsupported pagination
results type”, and once that was resolved the generated pager used the alias
itself as the page element type, producing code that did not compile. The
results element type is now resolved through alias indirection (and
optional/nullable wrappers) in both generators, so the pager’s element type
matches the endpoint’s returned page type.
(fix): Skip generating wire test files when all endpoints in a service are
skipped (e.g., file download or bytes request body endpoints). Previously
this produced a test file with a missing require import.
(fix): Skip file download response endpoints from wire test generation. Autogenerated
examples for these endpoints produce error responses rather than binary content,
causing wire tests to always fail.
(feat): The Go SDK now accepts space-separated datetime strings (e.g. “2025-02-15 10:30:00+00:00”)
in addition to standard RFC3339 format during deserialization. This matches the leniency of
the Python and TypeScript SDKs.
(fix): Fixed a compilation error when a discriminated union’s discriminant property
name collides with one of its member discriminant values (e.g. a discriminant
“event” with a union member also keyed “event”). The discriminant struct field
is now disambiguated to keep the generated Go code valid and compilable.
(fix): Fixed a nil-pointer panic when an object or inlined request body extends an
alias. The generator now resolves the extended type through alias
indirection to its underlying object, so its properties are inherited
correctly instead of crashing generation.
(fix): Fix duplicate struct fields and getters generated for a discriminated union
when a base property shares a name with a property inherited via extends.
The base property is now skipped in favor of the extended property, so the
generated Go compiles.
(fix): Fix generated Go failing to compile for APIs that use literals. Undiscriminated
union members whose literal value is not a valid Go identifier (e.g. starting with
a digit) now produce a valid exported field name, literal query parameters are no
longer double-quoted, and literal path parameters are now passed as their concrete
value in dynamic snippets instead of nil.
(fix): Support endpoints with a stream-condition (stream-parameter) response. The
v1 generator now handles the non-streaming variant instead of aborting, and the
v2 generator includes the streamer helper files when an endpoint exposes a
stream-parameter response.
(fix): Support endpoints that use URI- or path-based pagination (next_uri / next_path).
The v1 generator no longer aborts with “uri pagination is not supported yet”; these
endpoints are generated as regular methods that return the full response.
(fix): Support endpoints that return a bytes response. The v1 generator no longer
aborts with “bytes requests are not supported yet”, and the generated client
method now returns []byte (reading the full response body).
(fix): Fixed the generated dynamic code snippets for endpoints with a bytes request
body so that they compile. A bytes body referenced as a property of a request
wrapper is now instantiated as a []byte, matching the generated struct
field, and a standalone bytes parameter now defaults to io.Reader (matching
the SDK’s useReaderForBytesRequest default) instead of being keyed off an
unset config value. Previously the snippet wrapped the wrapped-request body in
bytes.NewReader, producing code that did not match the []byte field type.
(fix): Reserve the ExtraProperties field name so a user-defined property named
EXTRA_PROPERTIES (or any casing of it) no longer collides with the built-in
GetExtraProperties() accessor. The user property is now generated as
FieldExtraProperties (its JSON wire name is unchanged), so the generated Go
compiles.
(fix): Honor the exportedClientName config when naming the generated root client
constructor. Previously the SDK always exported NewClient while generated
dynamic snippets referenced New<exportedClientName>, producing snippets
that did not compile.
(feat): Forward-compatible discriminated unions: unmarshaling JSON with an unknown
discriminant value no longer drops the variant payload. The raw JSON is
preserved internally and returned verbatim when the union is re-marshaled,
so unknown server-introduced variants round-trip losslessly. Known
discriminants and Accept visitor behavior are unchanged.
(feat): Expose Stream[T].LastRetryMs() on the SSE runtime, mirroring LastEventID().
It returns the most recently advertised retry: reconnection time in
milliseconds (sticky per the SSE spec), so callers can read the directive
even when the server sends it in its own frame with no data: — in which
case the per-event StreamEvent.Retry is 0. The value persists across
reconnects.