fix(cli): emit custom scalars and all named types in GraphQL converter#16140
fix(cli): emit custom scalars and all named types in GraphQL converter#16140lifanzou wants to merge 1 commit into
Conversation
The GraphQL converter silently dropped custom scalars: collectTypeDefinitions hit a `continue` for non-built-in GraphQLScalarType, so scalars like DateTime, URL, and EmailAddress never landed in the `types` map. They were only inlined as `scalar` primitives at each reference site, which left them without a stable id the frontend can use as an href anchor. Now every custom scalar is emitted as a named alias type (mapping to the appropriate base primitive) with a stable, namespace-aware id, and references to custom scalars point to that id instead of inlining the scalar shape. Refs FER-10878 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
83eead5 to
30ac7d2
Compare
There was a problem hiding this comment.
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.
Docs Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on
Docs generation runs |
SDK Generation Benchmark ResultsComparing PR branch against median of 5 nightly run(s) on Full benchmark table (click to expand)
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 |
Description
Linear ticket: Refs FER-10878
The GraphQL converter silently dropped custom scalars. In
collectTypeDefinitions, the loop hit acontinuefor any non-built-inGraphQLScalarType, so custom scalars (e.g.DateTime,URL,EmailAddress) never made it into thetypesmap. They only appeared inlined asscalarprimitives at each reference site, which left them without a stable id the frontend can use as an href anchor.This fix emits every custom scalar as a named alias type (mapping to the appropriate base primitive via the existing
convertScalarTypeDefinition/getBaseTypeForCustomScalarlogic) with a stable, namespace-aware id, and updates references to custom scalars to point at that id instead of inlining the scalar shape.Note: this PR intentionally does not add navigation/sidebar nodes for types or touch field-level arguments — those are tracked separately.
Changes Made
GraphQLConverter.collectTypeDefinitions: replaced thecontinuefor custom scalars with emission of a named aliasTypeDefinition(stable id, description preserved). Built-in scalars are still skipped (they map to inline primitives).GraphQLConverter.convertScalarType: custom-scalar references now return{ type: "id", value: <typeId> }so they anchor to the emitted named type. Built-in scalars are unchanged (inline primitives).basicfixture lands intypesas an alias, (2) built-in scalars are not emitted, (3) references use the stable id, and (4) ids are namespaced. Updated thebasicandaccount-schemasnapshots accordingly.fix-graphql-custom-scalars.yml(typefix).Testing
GraphQLConverter.test.ts, 6 passing)basic.json,account-schema.json)tsc) and lint/format pass (biome)🤖 Generated with Claude Code