Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DirectivesMustBeValid schema phase #954

Conversation

maartenvanvliet
Copy link
Contributor

I noticed in the SDL rendering output that a macro directive that did not
specify the on clause would render invalid SDL.

E.g.

    directive :foo do
      arg :baz, :string
    end

Would render in SDL

directive @foo(baz: String) on

So the directive locations are missing making it invalid.

This PR adds a phase to the schema pipeline to check whether
the directive locations are set. I also check whether the locations
themselves are valid.

I noticed in the SDL rendering output that a macro directive that did not
specify the `on` clause would render invalid SDL.

E.g.
```elixir
    directive :foo do
      arg :baz, :string
    end
```

Would render in SDL
```
directive @foo(baz: String) on
```

This PR adds a phase to the schema pipeline to check whether
the directive locations are set. I also check whether the locations
themselves are valid.
@binaryseed
Copy link
Contributor

Awesome!

@binaryseed binaryseed merged commit f434bf7 into absinthe-graphql:master Nov 27, 2020
@maartenvanvliet maartenvanvliet deleted the issues/directive_must_be_valid branch November 27, 2020 20:27
@maartenvanvliet
Copy link
Contributor Author

Thanks for merging!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants