-
Notifications
You must be signed in to change notification settings - Fork 527
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
Override "__" fields from schema #648
Override "__" fields from schema #648
Conversation
Getting error: "Cannot query field \"upcasedTitle\" on type \"Post\". Did you mean \"upcasedTitle\"?"
Hey! Thanks for taking a shot at this. I don't think I articulated the route I want to go super well though. What I'd like to get to is, for all intents and purposes, not really having introspection fields at all. The idea would be that one of the schema building phases would just go to every object and add a There's still a schema validation rule which says that you can't name fields starting with The built in introspection resolvers would of course exclude these introspection fields from introspection results. As far as extending objects and fields I should have directed you at the At the moment the only decorators that are merged in are for resolvers but I think @bruce has a branch somewhere that lets you add fields. Let me update this shortly. |
ok--let me give that shot. I might ping you on Slack to confirm a few points |
@benwilson512 I managed to get the fields added, but I think I hit a major issue: fragment F0 on SearchResult {
...F1
__typename
} Don't work correctly on Unions, since they do not have fields |
There seems to be an issue with fragments
ab9096d
to
8d60cb4
Compare
@benwilson512 do you want the |
@benwilson512 I think I have the introspection fields working the way you describe. Do you want me to move the manipulation functions to be part of the decorator stuff? I can merge #649 into this branch and start adding if you want |
Yes feel free to merge that branch in. I'll review what you've got here shortly. |
a63c6b0
to
e86cf6d
Compare
This allows mapping the Enum Value back to its type
lib/absinthe/blueprint.ex
Outdated
end | ||
|
||
@doc """ | ||
Index the types bye their name |
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.
Index the types by their name :)
This allows mutations to identify the input field which was in error
Any updates on this? @michaelkschmidt @benwilson512 This |
@WolfDan Our need for this feature was to expose custom meta data to the introspection queries. Our final solution achieves this doing something like this def run(blueprint = %Blueprint{}, _) do
...
blueprint =
blueprint
|> Blueprint.add_field("__Type", type_fields)
|> Blueprint.add_field("__Field", field_fields)
|> Blueprint.add_field("__EnumValue", enumval_fields)
{:ok, blueprint}
end Originally we were going to expose using " _ _ " names, but we backed down to a single "_" prefix instead. This probably means " _ _ " fields isn't strictly necessary anymore, but I have not had time to go back and see if everything could be moved inside a library instead @benwilson512 I am open for ideas on how to proceed with this. Do you still want override able introspection fields? |
Oh I see @michaelkschmidt My problem is more about deleting/adding/modifing fields based on SDL field decorators, which from what I've seen this PR does (somewhat what prisma.io does) |
@michaelkschmidt this is really great work. There's a few things I want to tweak, so I'm gonna merge this into a feature branch on Absinthe itself and go from there. |
@benwilson512 here is the PR we talked about yesterday. Please let me know if you wanted it done a different way
I'm still figuring out how to add fields via the pipeline stuff. I intended to add them to the unit tests here too