Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Reject directives applied at the wrong location, without a required argument or twice in 15.0.0

Open
#884 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
graphql, java, kotlin

Research direction

Start with SchemaParser#directiveProblems and SchemaParser#directivesOf, then read DirectiveTest.should warn about invalid applied directives and keep them. Replace the warnings with SchemaError using the same messages, and cover the type extension case for duplicate non-repeatable directives. Update the 15.0.0 release notes; done when invalid applications fail with the expected errors and the test and release notes describe the change.

Written by the indexing model from the issue text.

Description

enhancement

Since #225, tools logs a warning when a schema applies a directive in a way its definition doesn't allow, and still builds the schema:

directive @uppercase on OBJECT
directive @auth(role: String!) on FIELD_DEFINITION
directive @cached(ttl: Int) on FIELD_DEFINITION

type Query {
    motto: String @uppercase
    secret: String @auth
    members: [Member!] @cached @cached(ttl: 10)
}

Directive @uppercase is applied to field 'Query.motto', but it's declared on OBJECT, not FIELD_DEFINITION.
Directive @auth is applied to field 'Query.secret' without its required argument 'role'.
Directive @cached isn't repeatable but is applied more than once to field 'Query.members'.

graphql-java's SchemaGenerator rejects all three, and the spec doesn't allow them either. But they always built with tools, so failing on them has to wait for a major release.

What to change
  • replace the warnings from SchemaParser#directiveProblems with a SchemaError that has the same messages
  • probably do the same for the warning in SchemaParser#directivesOf, when a type extension applies a non-repeatable directive the type already has. It's the same mistake, it just drops the repeat today
  • turn DirectiveTest.should warn about invalid applied directives and keep them into a test for the error
  • mention it in the 15.0.0 release notes
Dominant language
Kotlin
Stars
824
Forks
175
Avg merge
2d 5h
Merged PRs (30d)
52

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from graphql-java-kickstart/graphql-java-tools

All issues in graphql-java-kickstart/graphql-java-tools

Similar issues

More Kotlin issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.