Skip to content

Depth validation on input fields #434

Answered by P4sca1
P4sca1 asked this question in Q&A
Discussion options

You must be logged in to vote

I solved this using an extra input type.

function createGameFilter(
	t: InputFieldBuilder<TypesWithDefaults, 'InputObject'>
) {
	return {
		short: t.field({ type: StringFilter }),
		name: t.field({ type: StringFilter }),
		description: t.field({ type: StringFilter }),
		updatedAt: t.field({ type: DateTimeFilter }),
		createdAt: t.field({ type: DateTimeFilter }),
	}
}

export const GameFilter = builder.inputType('GameFilter', {
	fields: (t) => ({
		...createGameFilter(t),
		AND: t.field({
			type: [NestedGameFilter],
			required: { list: false, items: true },
		}),
		OR: t.field({
			type: [NestedGameFilter],
			required: { list: false, items: true },
		}),
	}),
})

export const NestedGame…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by P4sca1
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