Skip to content

Commit 73724f4

Browse files
committed
Move ScalarVariant type to schema-mutator.ts
After the TypeGraph refactor in PR #77, ScalarVariant was removed from the context module. Move it to schema-mutator.ts where it belongs since it's part of the MutatedSchema interface.
1 parent 27f0cc6 commit 73724f4

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

packages/graphql/src/mutation-engine/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ export {
99
GraphQLScalarMutation,
1010
GraphQLUnionMutation,
1111
} from "./mutations/index.js";
12-
export type { MutatedSchema } from "./schema-mutator.js";
12+
export type { MutatedSchema, ScalarVariant } from "./schema-mutator.js";

packages/graphql/src/mutation-engine/schema-mutator.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import {
55
isVoidType,
66
navigateTypesInNamespace,
77
type Enum,
8+
type IntrinsicType,
89
type Model,
910
type ModelProperty,
1011
type Namespace,
@@ -14,7 +15,6 @@ import {
1415
type Type,
1516
type Union,
1617
} from "@typespec/compiler";
17-
import type { ScalarVariant } from "../context/index.js";
1818
import { isInterface } from "../lib/interface.js";
1919
import { getOperationKind } from "../lib/operation-kind.js";
2020
import { getGraphQLBuiltinName, getScalarMapping } from "../lib/scalar-mappings.js";
@@ -27,6 +27,21 @@ import {
2727
import type { GraphQLMutationEngine } from "./engine.js";
2828
import { GraphQLTypeContext } from "./options.js";
2929

30+
/**
31+
* Scalar variant information for encoded scalars.
32+
* When a scalar has @encode, we emit it as a different GraphQL scalar (e.g., bytes + base64 → Bytes)
33+
*/
34+
export interface ScalarVariant {
35+
/** The original TypeSpec scalar type, or IntrinsicType for `unknown` */
36+
sourceScalar: Scalar | IntrinsicType;
37+
/** The encoding used (e.g., "base64", "rfc3339") */
38+
encoding: string;
39+
/** The GraphQL scalar name to emit (e.g., "Bytes", "UTCDateTime") */
40+
graphqlName: string;
41+
/** Optional specification URL for @specifiedBy directive */
42+
specificationUrl?: string;
43+
}
44+
3045
/**
3146
* The fully-mutated schema produced by `GraphQLMutationEngine.mutateSchema`.
3247
*

0 commit comments

Comments
 (0)