diff --git a/.changeset/eight-crews-clean.md b/.changeset/eight-crews-clean.md new file mode 100644 index 00000000000..094803988e7 --- /dev/null +++ b/.changeset/eight-crews-clean.md @@ -0,0 +1,5 @@ +--- +'graphql-language-service': patch +--- + +Fix JSON schema for custom scalars validation diff --git a/packages/graphql-language-service/src/utils/getVariablesJSONSchema.ts b/packages/graphql-language-service/src/utils/getVariablesJSONSchema.ts index 63fe1a2324c..0b6833e599f 100644 --- a/packages/graphql-language-service/src/utils/getVariablesJSONSchema.ts +++ b/packages/graphql-language-service/src/utils/getVariablesJSONSchema.ts @@ -144,9 +144,8 @@ function getJSONSchemaFromGraphQLType( definition.enum = type.getValues().map(val => val.name); } - if (isScalarType(type)) { - // I think this makes sense for custom scalars? - definition.type = scalarTypesMap[type.name] ?? 'any'; + if (isScalarType(type) && scalarTypesMap[type.name]) { + definition.type = scalarTypesMap[type.name]; } if (isListType(type)) { definition.type = 'array';