Open kp8910 opened 4 months ago
/* eslint-disable prettier/prettier */ import { GraphQLSchema, print } from 'graphql'; import gql from 'graphql-tag'; import { loadFilesSync } from '@graphql-tools/load-files'; import { mergeTypeDefs } from '@graphql-tools/merge'; import { buildSubgraphSchema } from '@apollo/subgraph'; import { DateTypeDefinition, // TimeTypeDefinition, DateResolver, TimeResolver, DateTimeResolver, TimestampTypeDefinition, } from 'graphql-scalars'; import GraphQLDecimal from 'graphql-type-decimal'; const DecimalDefinition = ` scalar Decimal `; const buildSchema = (schemaPath: string, resolvers: any): GraphQLSchema => { const typesArray = loadFilesSync(schemaPath); if (typesArray.length <= 0) { throw Error(`No schema files found with file glob pattern: ${schemaPath}`); } const typeDefs = mergeTypeDefs([ ...typesArray, DateTypeDefinition, // TODO: put this back after account-graphql-service removes "Time" type // TimeTypeDefinition, TimestampTypeDefinition, DecimalDefinition, ]); const schema = buildSubgraphSchema([ { typeDefs: gql(print(typeDefs)), resolvers: { ...resolvers, Date: DateResolver, Time: TimeResolver, // graphql-scalars calls this Datetime what we call Timestamp Timestamp: DateTimeResolver, Decimal: GraphQLDecimal, }, }, ]); return schema; }; export default buildSchema;
I am trying to integrate the new type in existing code, but it is not identifying the new type, can you help me out in configuring the new type
@SudhagarS can you help me with the above?
I am trying to integrate the new type in existing code, but it is not identifying the new type, can you help me out in configuring the new type