Skip to content

PothosSchemaError [GraphQLError]: <unnamed ref or enum> has not been implemented #1476

Closed Answered by arvi
arvi asked this question in Q&A
Discussion options

You must be logged in to vote

Solved this for some reason using spread operator.

// in schema objects dir
const StatusTypesOptions = ['active', 'inactive'] as const;
export const StatusTypes = builder.enumType('StatusTypes', {
	values: StatusTypesOptions,
});

export const MyStatus = builder.objectRef<MyStatusRoot>('MyStatus');
builder.objectType(MyStatus, {
	fields: t => ({
		...addStatusField({
			t,
			fieldType: StatusTypes,
		}),
	}),
});

// in schema objects field utils dir
export const addStatusField = ({
	t,
	fieldType,
	fieldName = 'status',
}: AddStatusFieldArgs) => {
        // .... other logic here
	return {
		[fieldName]: t.field({
			type: fieldType,
			resolve: root => root.status,
		}),
	};
};

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by arvi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant