Error: The value for "link" on "NAME_OF_THE_FIELD" in type "NAME_OF_THE_TYPE" is invalid, the record type does not exist.
typeDefs: `
...
"Scalar for any (JSON) value"
scalar Any
...
"Information about the API"
type API {
"Environment of the API"
environment: String!
"Name of the API"
name: String!
"Current version of API"
version: String!
"Current Position"
ipLookup: Any @deprecated(reason: "May be to much information")
}
...
`,
resolvers: {
/** Resolver for any (JSON) */
Any: YosAnyScalar,
...
}
import { GraphQLScalarType } from 'graphql';
/**
* Any scalar type for GraphQL
* Inspired by https://github.com/taion/graphql-type-json
*
* @type {GraphQLScalarType}
*/
export const YosAnyScalar = new GraphQLScalarType({
/**
* Name of the scalar
*/
name: 'Any',
/**
* Description of the scalar
*/
description: 'The `Any` scalar represents JSON values as specified by ' +
'[ECMA-404](http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf).',
/**
* Parse value from the client
* @param value
* @returns {any}
*/
parseValue(value: any): any {
return value;
},
/**
* Serialize value to the client
* @param value
* @returns {any}
*/
serialize(value: any): any {
return value;
},
/**
* Parse literal
* @param valueNode
* @param variables
* @returns {any}
*/
public static parseLiteral(valueNode: ValueNode, variables?: Maybe<YosObject>): any {
switch (valueNode.kind) {
case Kind.STRING:
case Kind.BOOLEAN:
return valueNode.value;
case Kind.INT:
case Kind.FLOAT:
return parseFloat(valueNode.value);
case Kind.OBJECT: {
const value = Object.create(null);
valueNode.fields.forEach(field => {
value[field.name.value] = YosGraphQL.parseLiteral(field.value, variables);
});
return value;
}
case Kind.LIST:
return valueNode.values.map(n => YosGraphQL.parseLiteral(n, variables));
case Kind.NULL:
return null;
case Kind.VARIABLE: {
const name = valueNode.name.value;
return variables ? variables[name] : undefined;
}
default:
return undefined;
}
}
});
Error: The value for "link" on "ipLookup" in type "API" is invalid, the record type does not exist.