-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
console and CLI: throw intuitive error messages when unsupported defintions are used in custom types #4666
Comments
Hey @frossi85
Read more about custom types here. However, not getting a valid feedback on an error is a bug, so I am rescoping this issue to return proper feedback when an error happens. |
Thanks for the quick response, I did not get this:
I read the docs but not sure how that can be achieved with my current API. Are you suggesting that I split my API in 2, one for the root object, and other for the metadata object and then relate them in some way? Also, the Hasura team has plans to implement Interfaces and Union types as custom types? If it is a yes, do you have an estimate like 2020 Q4 or some approx? |
Also in cases like this, I think that having a way to define some mapping function in the actions to map API responses to the output type, plus cache over those API calls and relationships between Actions not only with a table will solve this issue without implementing that objects can contain objects. How? In my example, I would create two actions calling the same API URL, in one I would define the type:
with a mapping function like this: Then define another action with this type:
And then define a relationship from Asset to Metadata. So if the cache is in place my API will be called just one time and I will be able to construct more advanced graphql schemas without changing my old API. The idea to create a graphql server to overcome the limitations of Hasura goes against the philosophy of Hasura (at least si what I see that you are trying to do) of developing Graphql API as fast as u can without friction and with the ability of reuse old APIs that you already built. I know you are doing the best guys and this is great but this is just an idea on how maybe you can enhance the product because mapping function will not help just in this scenario but in many other, like my old API use this casing in the response: { my_prop } but with Hasura we are trying to use this: { myProp } or the other way around. I hope the feedback helps you to keep rocking it. |
FYI, I have stumbled across this issue trying to use Actions to deliver results to Dart types (Flutter), using Artemis to code gen all the types based on the gql schema and queries. I'll have to rethink how to strongly type nested Actions outputs. The somewhat cryptic error I get is |
any roadmap for implementing the feature? |
@abdullah2993 as you can see, work had started in #5434 and it's been stalled at the moment. The changes on the console are done, and similar changes on the CLI were required. We will pick this up again, soon. cc @beerose |
According to docs you can define only relation between action and table, but not between 2 actions. Probably I missed something? |
We found such a solution - use jsonb
|
did u fix that issue? |
Gents, I have a service that will return a complex object as output, I need all those arrays of objects and other properties as objects to serve my front end. |
Having the same problem but yeah, using just jsonb solves it |
Hi,
I am trying to create an action to call one of my rest endpoints but it seems that Hasura does not support fully GraphQL specs. Here is the action definition:
When I click on the Create button basically nothing is happening, there is not error or any feedback. So my guess was that probably union was not supported, even if it was part of GraphQL spec. So when I removed all the metadata related types and field the action was created. Then I tried to create just one metadata type with all optional types like this:
I got this error:
validation for the given custom types failed because the type "Metadata" of the field "metadata" in the object type "Asset" is object type which isn't allowed
Which is strange because GraphQl also supports it, and seems a really important feature to be able to a couple already implemented APIs with Hasura Action. The first issue while I would love to see it is not a real stopper but the seconds one it is.
So the question if these are bug or current limitations, and when you are planning to implement them if that is the case.
Thanks
The text was updated successfully, but these errors were encountered: