ariadne icon indicating copy to clipboard operation
ariadne copied to clipboard

Validate that root resolvers are set

Open rafalp opened this issue 6 years ago • 2 comments
trafficstars

Ariadne's make_executable_schema should by default check if fields on Query, Mutation and Subscription have set resolvers, and raise ValueError with appropriate type and field names to save dev from forgetting about those.

This option should be disableable in the case when API relies heavily on root_value or its only to keep schema browseable.

rafalp avatar May 29 '19 13:05 rafalp

How about a bindable that checks this? You could opt in by passing it as the last type definition.

patrys avatar May 29 '19 13:05 patrys

This could even be an util called after make_executable_schema, eg:

schema = make_executable_schema(...)

validate_root_resolvers_are_set(schema)

That way it'll be useful even after people do something to the schema after make_executable_schema()

rafalp avatar Dec 02 '21 12:12 rafalp