-
Notifications
You must be signed in to change notification settings - Fork 529
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 SDL/macro type extensions #1157
Add SDL/macro type extensions #1157
Conversation
Could this support this syntax? Since that is what extend object :foo do
field :name, :string
end absinthe_relay node object :person do
field :name, :string
field :age, :string
end |
Ah interesting, forgot about that syntax usage in relay. I'll have a look. |
Thx! Fixed it in 675808a |
The formatting failures in CI were pre-existing |
e2a053c
to
cf372f9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent stuff, can you add a changelog entry?
Thx! I've added an entry 🎉 |
schema = %{ | ||
schema | ||
| directive_definitions: directives, | ||
type_extensions: type_extensions, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you still need this in this phase now that you added that other ApplyTypeExtensions
phase?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've extracted the type extension imports to a separate phase, like with import_directives.
Changed the import to use Also, added a fix to extend builtin types through type extensions and changed the |
Moved the defaults to the pipeline configuration. This way the @kdawgwilk sorry, this clashes a bit with your PR. The same structure can be applied there. |
18857de
to
980c9d7
Compare
980c9d7
to
4b902d8
Compare
@maartenvanvliet What is the overall state of this PR? |
Gives more opportunity for overriding/removing builtin imports. E.g. the DeprecatedDirectiveFields phase is no longer needed. Its functionality can be achieved on configuration alone.
4b902d8
to
10e5baa
Compare
Just fixed a merge conflict with the changelog. Now, it's good to go. 🚀 I have an idea around extending scalar types, so a type extension can be used to make the Int type spec compliant (see #921) It goes beyond the spec and can be left for another PR though. |
Gave it a shot to add support for
extend
to SDL. Once that was running, adding macro support was not that difficult.It follows the graphql spec for the most part, though schema declarations cannot be extended as of yet. The validations are done by the currently existing validation phases.
I looked at #821 but decided against the
syntax in favor of
since it was easier to implement and is closer to the graphql syntax. I also think it will work better with imports.
Imports across modules work as well, using the
type_extensions
field. It uses theTypeImports
phase, though it could be moved to a different module if necessary or even a separateimport_type_extensions
macro instead of theimport_types
macro.Fixes #772