@@ -23,7 +23,7 @@ import { getOperationKind } from "./lib/operation-kind.js";
2323import { type GraphQLEmitterOptions , reportDiagnostic } from "./lib.js" ;
2424import { resolveTypeUsage , GraphQLTypeUsage , type TypeUsageResolver } from "./type-usage.js" ;
2525import { listSchemas } from "./lib/schema.js" ;
26- import { createGraphQLMutationEngine } from "./mutation-engine/index.js" ;
26+ import { createGraphQLMutationEngine , GraphQLTypeContext } from "./mutation-engine/index.js" ;
2727import { GraphQLSchema } from "./components/graphql-schema.js" ;
2828import {
2929 ScalarVariantTypes ,
@@ -36,7 +36,8 @@ import {
3636import { QueryType , MutationType , SubscriptionType } from "./components/operations/index.js" ;
3737import type { ClassifiedTypes , ModelVariants , ScalarVariant } from "./context/index.js" ;
3838import { getNullableUnionType } from "./lib/type-utils.js" ;
39- import { getScalarMapping } from "./lib/scalar-mappings.js" ;
39+ import { getScalarMapping , isGraphQLBuiltinScalar } from "./lib/scalar-mappings.js" ;
40+ import { getSpecifiedBy } from "./lib/specified-by.js" ;
4041
4142/**
4243 * Main emitter entry point for GraphQL SDL generation (component-based)
@@ -175,9 +176,10 @@ function mutateTypes(context: EmitContext<GraphQLEmitterOptions>, schema: { type
175176 processedScalars . add ( graphqlName ) ;
176177 mutatedScalars . push ( mutation . mutatedType ) ;
177178
178- // Store specification URL if available
179- if ( mutation . specificationUrl ) {
180- scalarSpecifications . set ( graphqlName , mutation . specificationUrl ) ;
179+ // Store specification URL if available (set by the scalar mutation via state map)
180+ const specUrl = getSpecifiedBy ( context . program , mutation . mutatedType ) ;
181+ if ( specUrl ) {
182+ scalarSpecifications . set ( graphqlName , specUrl ) ;
181183 }
182184 }
183185 } ;
@@ -195,7 +197,7 @@ function mutateTypes(context: EmitContext<GraphQLEmitterOptions>, schema: { type
195197 }
196198 return ;
197199 }
198- if ( target . type . kind === "Scalar" && context . program . checker . isStdType ( target . type ) ) {
200+ if ( target . type . kind === "Scalar" && context . program . checker . isStdType ( target . type ) && ! isGraphQLBuiltinScalar ( target . type ) ) {
199201 const encodeData = getEncode ( context . program , target ) ;
200202 const encoding = encodeData ?. encoding ;
201203 const mapping = getScalarMapping ( context . program , target . type , encoding ) ;
@@ -212,7 +214,9 @@ function mutateTypes(context: EmitContext<GraphQLEmitterOptions>, schema: { type
212214
213215 navigateTypesInNamespace ( schema . type , {
214216 model : ( node : Model ) => {
215- const mutation = engine . mutateModel ( node ) ;
217+ // Skip array models — they're represented as GraphQL list types, not object types
218+ if ( isArrayModelType ( context . program , node ) ) return ;
219+ const mutation = engine . mutateModel ( node , GraphQLTypeContext . Output ) ;
216220 mutatedModels . push ( mutation . mutatedType ) ;
217221 originalToMutated . set ( node , mutation . mutatedType ) ;
218222 } ,
0 commit comments